| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Requiring common actually just does things.
I suppose we don't need to assign it to a variable though.
Sorry, something went wrong.
There was a problem hiding this comment.
Are these 'things' relevant to tests that don't use the variable?
Sorry, something went wrong.
There was a problem hiding this comment.
Yes. See https://github.com/nodejs/node/blob/master/test/common.js#L304-L313 among other things. Actually, all tests should require common. (Perhaps it should just be pre-loaded, not sure.)
Sorry, something went wrong.
There was a problem hiding this comment.
If it's just this leaked global check, I see two options:
Sorry, something went wrong.
There was a problem hiding this comment.
There's this too but I think that's it:
Lines 142 to 151 in 68dc69a
Sorry, something went wrong.
There was a problem hiding this comment.
what's the big deal with requiring common? are you trying to shave off ms?
Sorry, something went wrong.
There was a problem hiding this comment.
Requiring common without actually using it violates the rule I'm trying to add 😉
Sorry, something went wrong.
There was a problem hiding this comment.
Just saw that the rule allows exceptions per varsIgnorePattern, so that could be another option.
Sorry, something went wrong.
There was a problem hiding this comment.
Could also change var common = require('../common.js') to just require('../common.js');...
Sorry, something went wrong.
There was a problem hiding this comment.
That looks a bit strange imho and would confuse someone who doesn't know about this 'dependency'.
Sorry, something went wrong.
|
Looks like option I need was added just in 1.3 (eslint/eslint@91fc1c5), making this PR depend on #2286. |
Sorry, something went wrong.
|
This is obsolete now with #4536. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This enables the no-unused-vars rule. Issues that came up were mostly the variables on top of tests and there were a few cases where there was leftover dead code.
I intentionally didn't enable the feature for unused function arguments yet. I think the best to go about these is to comment out the arguments in lib while removing them in test, does that sound good?
Note that this is somewhat WIP, as there were a few cases where the intention seemed to be to use some of these variables, but I'm submitting this now as-is for some feedback.