-
-
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 not checking dependencies #1177
Comments
Add |
@ljharb it does not help for me |
Does not work for me neither. |
In the doc, it says
Here in your example, |
@ljqx it makes sense |
i'm facing similar issue with lerna monorepo |
For this issue, would you accept a PR to add a new option to the This rule also currently checks for aliases for package names. I think having an option to disable this check could make sense for some projects that don't need this extra functionality. |
There's already |
Ah yes, I noticed that rule exists, but I think for our purposes and others as well, it would be helpful if we had this as an option on this rule. The way my project is set up, I use symlinks for some of my custom packages, and imports for these packages wouldn't be able to be resolved, since they point to the compiled |
You should be compiling your typescript before running the linter, so I'm not sure why that's an issue. The problem is that we can't know if it's a package.json dependency until it's actually resolved, because it could be coming from a symlink, or a TS "path", or a babel alias, etc - that's what the custom resolver answers for us. |
Yeah, I think you're right that in the cases where people run We're actually working on a project to migrate off of TSLint onto ESLint, which is why we're trying to use rules that have parity with the old TSLint versions, since it would be frustrating for developers used to having these lint errors caught in the editor suddenly have their builds failing during CI. |
Unfortunately I think it's just not technically possible to do this, because eslint-plugin-import supports far more variations on specifiers than TS (and thus TSLint) does. |
The same question on stackoverflow https://stackoverflow.com/questions/52554918/eslint-no-extraneous-dependencies-issue
I have a problem with eslint rule
import/no-extraneous-dependencies
What needs to do. If js file has import with a package which not present in closest parent package.json - show error.
Rule description : https://github.com/benmosher/eslint-plugin-import/blob/HEAD/docs/rules/no-extraneous-dependencies.md
Project very simple:
Structure of folders:
Package.json:
My eslintrc.js
my index.js
moment
is not present inpackage.json
, but when I run eslint with my config, it's not showing errors:./node_modules/eslint/bin/eslint.js -c ./eslintrc.js ./index.js
Result - nothing, but when I change
eslintrc.js
line"devDependencies": true,
, then add to index.jsimport 'eslint';
and rerun CLI command, all works as expected, and error is showing.What I'm doing wrong?
The text was updated successfully, but these errors were encountered: