-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[no-extraneous-dependencies] Add exceptions? #422
Comments
You can, in some cases, but this is a limitation of ESLint. The other options are to:
Or my favorite, use glob based configurations eslint/eslint#3611. Unfortunately, that is not yet implemented :/ (should you be using Of course, we could disable the rule in the code if we notice that the file in question is in some directory, but this could be applied to so many rules that it's better to invest time to make it work in eslint/eslint#3611 IMO. Let me know if this answers your needs. If so, I'll close the issue :) |
Yep I was using the comment to disable it, I'm ok :) I thought it was potentially an error in the rule but everything is ok if you suggest using the comment anyway :) Thanks! |
@tleunen you could set the option rules:
import/no-extraneous-dependencies: [error, { devDependencies: true }] Then you'll get reports of any packages referenced that are not included I think that might work for you? This is how I would use the rule, in your case, since you have your test code separated into a |
Yep, you're right, but since it's just 1 specific dependency, I'm ok with the comment ;) |
@tleunen I had the same question. The Internet is small sometimes 😄 |
FWIW: v1.15.0 shipped with #527, which allows globs in addition to booleans for the various dependency flavors. Docs here: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md#options (apparently we changed our minds 😅) |
Hi all,
But is still giving my a bunch of errors, all of them like this one
Any help would be appreciated |
Is it listed in your package.json anywhere? It'd be better to file a new issue, so we can debug it properly. |
@Willibaur: if |
actually, scratch that: you may be able to specify refer to the import/core-modules docs for more info. |
@benmosher Thanks, It solved the issue |
@benmosher |
@siddhartharora02 I don't understand what you're describing but if you're experiencing issues, feel free to open a new issue. |
Simple to do:
add this to rules |
Sure, but then you're disabling this very useful rule. |
- fetch is not defined eslint/eslint#4015 - propTypes in dependencies import-js/eslint-plugin-import#422
Pretty sure that only rules are only supposed to be placed there. Developer can figure out the reason why that rule is there. Was not able to exclude electron from the rule, see import-js/eslint-plugin-import#422
For a specific package, I'm importing
babel-core
in my test files, butbabel-core
is set as a devDep because I'm compiling the files before publishing my package. Therefore, there's no reason to put the module as a direct dependency.Would it be possible to not run
no-extraneous-dependencies
in specific directories/files?? Liketest.js
,test/**/*.js
,__tests__/**/*.js
,**/*.test.js
or**/*.spec.js
The text was updated successfully, but these errors were encountered: