import/no-unresolved requires installed node_modules
See original GitHub issueIt seems that import/no-unresolved
will complain for valid import statements if node_modules
isn’t present or it’s outdated.
When using a complex build system, npm install
is often executed inside a build system sandbox and node_modules
might never be present in the original repository where eslint runs (e.g. through IDEs).
Is there a way to prevent import/no-unresolved
from complaining about valid import statements for third-party packages that are listed in package.json
? I looked at the import/no-extraneous-dependencies
rule but it doesn’t report any errors if the package cannot be resolved in the first place.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
import/no-unresolved requires installed node_modules #1627
It seems that import/no-unresolved will complain for valid import statements if node_modules isn't present or it's outdated.
Read more >node.js - How to resolve "import/no-unresolved" in ESLint for ...
I was having this problem! Eslint cannot find the file's location because the path of the file is not fully defined, we must...
Read more >eslint-plugin-import - npm
Ensure imports point to a file/module that can be resolved. ( no-unresolved ); Ensure named imports correspond to a named export in the ......
Read more >no-restricted-imports - ESLint - Pluggable JavaScript Linter
Disallow specified modules when loaded by import ... For example, Node.js' fs module would not make sense in an environment that didn't have...
Read more >rollup.js
Importing CommonJS · Publishing ES Modules ... npm install --global rollup ... import { createRequire } from 'node:module'; const require ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not in the js ecosystem it’s not; it’s also a bad practice regardless of how often it’s used.
I don’t think it makes any sense for any js tool to not assume
npm install
has been ran.Hmm, that’s not really true. In a large multi-language monorepo it’s common to have eslint installed just once (usually in /third_party/bin/eslint or similar) and some build system (such as Bazel or Buck) takes care of running it for various isolated packages. In such scenario, eslint isn’t installed globally but it’s not in the package’s node_modules either. It’s invalid to assume that node_modules will be present, it might be managed by a build system.