-
Notifications
You must be signed in to change notification settings - Fork 214
Add the tests directory to default lint include #331
Comments
The reason why the test directory is currently left out is it usually requires a different set of linting rules because of the test environment, sometimes from assumed globals. My thoughts to this point have been, if they want tests linted, they can override to add the directory and make the changes to support their test environment. If we had a good answer to this, I think I might be persuaded to switch it. |
Ah fair point - happy to punt on this :-) |
Test middlewares can override this setting if they provide all necessary plugins for linting, are they? |
Is the only thing stopping us here is augmenting the eslint changes based on test middleware lint overrides? |
I think we should do this - and just adjust the test presets to ensure they do the right thing. If there are any cases not covered by them, then it's up to the end user to either override |
All three test presets actually already configure the relevant eslint plugins/globals: To make things even more resilient we could always expand the "lint presets must be defined before compile presets" check to also check for the registered jest/mocha/karma commands (we'll have to hardcode their names, but guess doesn't matter too much). |
The `tests` directory was already added to the `lint` script command by create-project, however it was not yet listed in the `include` for `eslint-loader`. The testing presets already update `envs` accordingly, to prevent errors from mocha/jest/... globals. The redundant `eslint.extensions` option has been removed, since that was only used by the ESLint Node API, which we no longer use. Fixes #331.
The `tests` directory was already added to the `lint` script command by create-project, however it was not yet listed in the `include` for `eslint-loader`. The testing presets already update `envs` accordingly, to prevent errors from mocha/jest/... globals. The redundant `eslint.extensions` option has been removed, since that was only used by the ESLint Node API, which we no longer use. Fixes neutrinojs#331.
Currently neutrino-middleware-eslint defaults the directory
include
list to just[neutrino.options.source]
:https://github.com/mozilla-neutrino/neutrino-dev/blob/10819ad89d9d408f79e29487af5ea430701ac6df/packages/neutrino-middleware-eslint/index.js#L30
It seems like linting should also be run against tests - and so
include
default instead to[neutrino.options.source, neutrino.options.test]
. (At least forneutrino lint
orneutrino test
, perhaps not for start/build?)Also it looks like the include/exclude from neutrino-preset-airbnb-base can be removed, since it's just repeating what is in neutrino-middleware-eslint:
https://github.com/mozilla-neutrino/neutrino-dev/blob/10819ad89d9d408f79e29487af5ea430701ac6df/packages/neutrino-preset-airbnb-base/index.js#L24
Thoughts? :-)
The text was updated successfully, but these errors were encountered: