Skip to content

Conversation

@kadler
Copy link
Member

@kadler kadler commented Jun 10, 2020

There's a few commits in here:

  • The first two are just some eslintrc cleanup.
  • The third configures the eslint environment for mocha for all tests and removes the now redundant eslint-env comments from them.
  • The fourth commit adjusts some AirBnB rules which conflict with Mocha's conventions/usage.
  • The last commit pulls in eslint-plugin-mocha and enables these rules for the tests, though it disables some rules due to many existing tests running not following these rules

This sets things up for #283 and more.

kadler added 4 commits June 10, 2020 17:42
Instead of disabling import/no-extraneous-dependencies and
import/no-unresolved globally, constrain them to the specific instances
where they are needed using eslint comments.

In addition, explain why the no-console error must be disabled.
Currently, all of our tests add a comment at the top of the file to
configure the eslint environment. Instead, we can set this for all tests
by using an override in the eslint config file.
Mocha conventions use nameless functions instead of arrow functions
because arrow functions lexically bind `this`, preventing you from
accessing the Mocha context. This prevents setting timeouts and other
things which require the Mocha context.

See https://mochajs.org/#arrow-functions and
airbnb/javascript#433
@kadler kadler requested a review from abmusse June 10, 2020 23:05
@kadler kadler marked this pull request as draft June 10, 2020 23:06
This pulls in the eslint-plugin-mocha and enables its use when linting
tests. Because our existing tests do not always follow the Mocha
conventions, some mocha rules are disable for now. See #289
@kadler kadler marked this pull request as ready for review June 10, 2020 23:16
Copy link
Member

@abmusse abmusse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kadler kadler changed the title Configure eslint properly for Mocha tests test: Configure eslint properly for Mocha tests Jun 10, 2020
@kadler kadler merged commit 89e67e6 into master Jun 10, 2020
@kadler kadler deleted the eslint-mocha branch June 10, 2020 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants