-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add and configure eslint-plugin-mocha #521
Conversation
Why the arrow function hate 😊 |
Arrow functions are bad in mocha tests because they prevent you from accessing the test context via |
(however, since we also want the test suite to run in |
I don't think we want to use this in the tests are you mention. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to remove the arrow functions constraint. But if you want to keep it I'm also okay with that.
I've wired up my brain so arrow functions with Inconsistency bothers me even more though -- so if we decide against including that rule, I think we should switch to arrow functions everywhere: #522 |
…ows)" This reverts commit 8420492.
…-with-rolling-eyes:
f8f9575
to
f08e726
Compare
I'm sort of torn - I actually had no idea that there was a functionality penalty using arrow functions with mocha. If I may ask, what is the use case for the mocha context API? I've always just been consistent with what each project currently does. In $work trees we do arrow functions for it/describe and I'd be surprised if many people reach for the feature. In summary I defer to those with stronger feelings - I'm perfectly happy to keep the constraint and relax it later since we already uphold it or convert wholesale. |
@alexjeffburke, the mocha test context can be use for building up state in Another use case is to install a test suite-wide feature or "plugin", for example something like https://www.npmjs.com/package/mocha-sinon, without adding a ... All of this doesn't matter so much anymore, though, as I already reverted the parts that prohibited arrow functions in Seems like everyone is on board with the other parts, so I'll merge :) |
The main use case for me is to prohibit
it.only
from being pushed accidentally.I enabled the rules that seemed most useful and hopefully not too controversial, but there are more: https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/README.md