Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Allow any var that sourced from a require in disallowMultipleVarDecl #1848

Closed
ValYouW opened this issue Oct 6, 2015 · 3 comments
Closed
Labels
Milestone

Comments

@ValYouW
Copy link
Contributor

ValYouW commented Oct 6, 2015

Hi,

In disallowMultipleVarDecl, when using allExcept require, what do you think about allowing all vars that sourced from a require call?
For example, this is currently failing on the Emitter var

var fs = require('fs'),
    Emitter = require('events').EventEmitter;

How about allowing such cases?
I played a little bit with the rule and came up with this:
ValYouW@999c714

Not sure it's 100% ok as I am not so familiar with esprima...

@markelog
Copy link
Member

markelog commented Oct 6, 2015

I think that would be a good idea, i think current behaviour could be considered as bug

@hzoo
Copy link
Member

hzoo commented Oct 7, 2015

@ValYouW maybe paste some code and play around with http://astexplorer.net/ if you want to make a PR for it later

ValYouW added a commit to ValYouW/node-jscs that referenced this issue Oct 7, 2015
ValYouW added a commit to ValYouW/node-jscs that referenced this issue Oct 7, 2015
ValYouW added a commit to ValYouW/node-jscs that referenced this issue Oct 7, 2015
ValYouW added a commit to ValYouW/node-jscs that referenced this issue Oct 7, 2015
@ValYouW
Copy link
Contributor Author

ValYouW commented Oct 7, 2015

Ahh, sorry for all the commits mess...
Created a PR #1849 (with tests) lets discuss it there...

ValYouW added a commit to ValYouW/node-jscs that referenced this issue Oct 8, 2015
@hzoo hzoo added this to the 2.3.1 milestone Oct 9, 2015
ValYouW added a commit to ValYouW/node-jscs that referenced this issue Oct 10, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants