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-new is incompatible with no-unused-vars in testing environments #762
Comments
This comment has been minimized.
This comment has been minimized.
|
Both these rules are usually quite useful in the general case, but there are always circumstances where you may need to override certain rules. asset.throws(function () {
new MyObject() // eslint-disable-line
})This is documented here: http://standardjs.com/#how-do-i-hide-a-certain-warning |
feross
closed this
Jan 24, 2017
This comment has been minimized.
This comment has been minimized.
|
Oh man I don't know how I missed that option. Thank you, |
This comment has been minimized.
This comment has been minimized.
|
No problem! |
lock
bot
locked as resolved and limited conversation to collaborators
May 10, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Jakobud commentedJan 24, 2017
•
edited
no-newandno-unused-varsis a weird combination of rules when it comes to building tests. For example, I want to test that an error is caught when instantiating an object incorrectly using Mocha for testing:Because I'm missing some parameters when instantiating my object here, I would expect my object to throw an error, which is does and Mocha tests it correctly. However,
newis used by itself without assigning it to a variable and StandardJS does not like this. So easy fix right:Fixed one issue but introduces another. Now StandardJS does like this because
foois defined but not used.What am I supposed to do in this situation? Seems kind of bogus that I would to write additional dummy code to use
foojust to satisfy StandardJS. Any advice?