Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upno-unused-vars very forgiving #419
Comments
This comment has been minimized.
This comment has been minimized.
|
It usually clashes with the ugly way that express defines handles error handlers... I brought it up here #216 (comment) and here xojs/xo#6 Although I would actually be in favour of making it more strict |
This comment has been minimized.
This comment has been minimized.
|
Ah, now I see, thank you! |
szkrd
closed this
Feb 15, 2016
This comment has been minimized.
This comment has been minimized.
|
It might be a good idea to open up discussion about this again, and to run thru the tests and see how many repos would be affected by changing this... |
This comment has been minimized.
This comment has been minimized.
|
@LinusU I use express. I feel this pain. |
dcousens
added
the
question
label
Feb 15, 2016
This comment has been minimized.
This comment has been minimized.
|
Yeah, me too. But it's literally the only place I have this problem though, which makes it a bit annoying since it could catch other bugs... |
This comment has been minimized.
This comment has been minimized.
|
We are mostly a koa shop :) Though adding it manually to eslintrc feels kinda dirty. |
This comment has been minimized.
This comment has been minimized.
|
@LinusU the other major places I had this issue ( |
dcousens
added
the
i wanna be the very best
label
Feb 15, 2016
This comment has been minimized.
This comment has been minimized.
|
I just opened an issue on |
This comment has been minimized.
This comment has been minimized.
|
Ran
|
This comment has been minimized.
This comment has been minimized.
akivajgordon
commented
Jan 5, 2017
|
For me, a consequence of not being informed about unused params can cause tests to fail. As an example, I started with an asynchronous test: it('should foo', (done) => {
somethingAsync().then(() => {
expect(...)
done()
})
})But then, I refactored my test and it no longer needed to be async: it('should foo', (done) => {
doSomething()
expect(...)
})Oops! Now my test fails because I never called |
This comment has been minimized.
This comment has been minimized.
|
I believe we used to lint for this, but then stopped doing that. Not sure
why, I missed the conversation on that one
…On Thu, Jan 5, 2017 at 11:49 PM Akiva Gordon ***@***.***> wrote:
For me, a consequence of not being informed about unused params can cause
tests to fail. As an example, I started with an asynchronous test:
it('should foo', (done) => {
somethingAsync().then(() => {
expect(...)
done()
})
})
But then, I refactored my test and it no longer needed to be async:
it('should foo', (done) => {
doSomething()
expect(...)
})
Oops! Now my test fails because I never called done(). Had the linter
warned me about done being unused, I would have removed it and not been
running an asynchronous test. In other words, the mere presence of the
done argument (or lack thereof) actually changes the way the test
behaves, so it would be nice if I was warned about it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWlersSYUoPvZJR9dFFvX9aG1bAz6Zoks5rPXOGgaJpZM4HaRxU>
.
|
This comment has been minimized.
This comment has been minimized.
|
Indeed, I am bitten by this often. |
This comment has been minimized.
This comment has been minimized.
|
What about "no-unused-vars": [2, { "vars": "all", "args": "all", "argsIgnorePattern": "^_$" }], |
This comment has been minimized.
This comment has been minimized.
|
@akivajgordon Mocha should not count the number of arguments to the function to determine whether it's async or sync. Fortunately, this kind of fanciness is going out of fashion: it's planned to be removed from express and was already removed from other libraries that do it, like superagent. It should have explicit methods for sync and async tests, IMO. @dcousens Any idea what the ecosystem impact of that rule change would be? @yoshuawuyts This was removed well over a year ago, I believe. |
This comment has been minimized.
This comment has been minimized.
|
It won't be a problem in the case of mocha though, since you always call the |
lock
bot
locked as resolved and limited conversation to collaborators
May 10, 2018
feross
reopened this
Jul 11, 2019
standard
unlocked this conversation
Jul 11, 2019
feross
added
enhancement
and removed
question
labels
Jul 11, 2019
This comment has been minimized.
This comment has been minimized.
|
Moving discussion to here: standard/eslint-config-standard#136 |
szkrd commentedFeb 15, 2016
Is it intentional that no-unused-vars are set only for variables, but not for arguments? I can live with it of course, just curious.
"no-unused-vars": 2vs."no-unused-vars": [2, { "args": "all" }]