-
-
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 #126
Comments
a la #158, need to allow/disallow core modules based on a flag, probably. |
Given the recent Twitter attention, this is what I was imagining as an implementation:
Options:
BTW: I can also imagine this being a separate plugin ( Actually... I think that might be the best option. See eslint-plugin-git for an example of how to integrate with the module utils package. |
I'm (as I'm writing) implementing it (and close to done). As for the options I was thinking more of something like a single options object, containing the following key:
I was thinking of only checking whether the module is registered in |
Maybe just |
Regarding sort order: I just referenced your plugin at the existing issue for sort order (#162). I've always been more interested in the static analysis and less about style, but I'm cool to add style rules if folks are interested in them. Meant to reach out to you earlier about it but hadn't gotten around to it, yet. 😅 Regarding rule option:
Regarding resolution: I'm concerned about imports of aliased modules, if the import is not resolved. For example, I often do something akin to // NODE_PATH=./src
import MCC from 'jsx/MyCoolComponent' // would it report that 'jsx' is not a dependency? It's not clear to me how you could disambiguate such an aliased import/require vs. one that does target Thus the suggestion of a new Also: it would be pretty sweet if |
Same here then :p
I lint my test files (obviously), and they require devDependencies. I don't see an easy way to tell ESLint that "this file is a production file, and that is a development file", as you can't define a config for a glob (yet). Since I don't know how to do that, I don't see how it is practical to have the default be
I didn't actually know about |
You can do it automatically for packages that use the
Ugh, that is such an anti-pattern... I don't think that should be a blocker for anything. Could add an option for people needing to work around it though.
👍 👍 |
True, but you do that for packages, not for apps (afaik?). But that would be one possible way, you're right, though pretty complex to implement (done that in an
In my implementation, in the error message I've added a tip to run |
That won't work for anybody who transpiles the contents of their |
I admit it's not foolproof, but it would work for many use-cases. For the rest, there could be an option to specify additional file paths. |
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Report
node_module
imports that are not declared in the siblingpackage.json
.Not sure what to name this.(edit: thanks @grabbou for a great suggestion)no-missing-dependencies
maybe? or justdependencies
?Needs an option to check in
dependencies
,devDependencies
, optional, peer, etc. Justdependencies
by default.i.e. given
package.json
:then report for
inspired by https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-missing-import.md
The text was updated successfully, but these errors were encountered: