-
Notifications
You must be signed in to change notification settings - Fork 26.6k
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
The imports
in tests for the rule import/no-extraneous-dependencies
#959
Comments
@Alex1990 the default is for the entire project, which is to only allow dependencies. The proper solution is to make a |
Okay, so I must create two |
Yep! You probably already need one for your tests anyways, to enable the mocha env, or to allow for more nested callbacks than in your production code, etc :-) |
Hi @ljharb, I was surprised by this too. I understand what you mean and it makes sense if you have a separate So am I correct in thinking that the way forward for us is to override the rule to allow |
@artisologic unfortunately, that approach (interleaved source/test files) is incompatible with a great many tools. Indeed, until eslint/eslint#3611 is done, it's simply not practical to use eslint and also use that approach - so I'd recommend avoiding that approach until all of the tools you use support a glob-style configuration. If you persist in interleaving tests and source, no matter how you configure this rule, you'll lose out on the most important benefit - ensuring that everything your source requires is explicitly listed as a dependency. |
Worth noting, with the latest published version of |
Yes, take a look at who filed the issue requesting it :-p import-js/eslint-plugin-import#470 This will be released as an update soon. |
@SimenB I'm waiting on import-js/eslint-plugin-import#602 / import-js/eslint-plugin-import#630, otherwise the globs have to be too accepting. |
|
…r test files. Relates to airbnb#959, airbnb#1089.
- Remove comma-dangle rule because of reasons stated by airbnb - Require strict because of reasons stated by airbnb - Do not allow importing devDependencies because a separate eslint config file should be used for tests (airbnb/javascript#959 (comment))
…r test files. Relates to airbnb#959, airbnb#1089.
Some of the dependencies in test code are in
devDependencies
. When I lint the test code, some errors appear:This error is unexpected.
The text was updated successfully, but these errors were encountered: