-
-
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
Lodash modularized libs cause false positive for import/extensions
#378
Comments
If you have a rule against extensions you could have a list of what those extensions are (deny list). |
I think ideally we should resolve the imported file and ensure that its extension is not being used. Directories with dots should be fine. It won't help in cases where the import can't be resolved, obviously. I think that's a substantial improvement. |
@jdalton The problem is that my rule is to deny all extensions, so listing them wouldn't work, but @benmosher's proposal sounds like a good solution. |
Fun fact: the rule already does what I suggested, probably as of 1.8.0. Looks like this PR is pinned to 1.7.0. Upgrading your import plugin version should fix it? |
@benmosher I used 1.9.0. |
Weird. Are you using a custom resolver? There was a critical issue with custom resolver loading in 1.9.0, just published the fix via 1.9.1 this morning. I suspect you aren't, though. Will look deeper into this, there must be a bug with the resolution. |
No custom resolver, but turns out I didn't have the dependency in |
I'm explicitly specifying extensions so it won't report when using for example `require('lodash.template')` and the dependency is not resolvable (read not installed). Also people might use Webpack and require files like `.css` and `.png` and those extensions should definitely be included. Read more: import-js/eslint-plugin-import#378
🤘 |
Config
Code
Result
Not sure how this should be handled, but I definitely don't want to specify all the Lodash modules as extensions. Ideally, Lodash would have used proper slugged names like
lodash-template
...// @jdalton
The text was updated successfully, but these errors were encountered: