import/no-unresolved does not support multiple nested package.json
See original GitHub issueFolder / file structure:
.
├── .eslintrc
├── package.json // Package 1
├── src
│ └── package.json // Package 2
│ ├── components
│ │ └── Foo.jsx
Content of Package 2
:
{
"name": "src"
}
This enables me to import Foo.jsx
like so (from anywhere):
import Foo from 'src/components/Foo';
This node resolution behaviour is standard as far as I know.
eslint-plugin-import
is not able to resolve my files:
5:23 error Unable to resolve path to module 'src/components/Foo' import/no-unresolved
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
import/no-unresolved does not support multiple nested ...
This enables me to import Foo.jsx like so (from anywhere):. import Foo from 'src/components/Foo';. This node resolution behaviour is standard as ...
Read more >The best way to run npm install for nested folders?
I think the most idiomatic thing is to have a single package.json file at the to of your project. · One idea would...
Read more >package.json - npm Docs
This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just a...
Read more >Modules: Packages | Node.js v19.3.0 Documentation
Introduction#. A package is a folder tree described by a package.json file. The package consists of the folder containing the package.json file and...
Read more >An In-Depth Explanation of package.json's Dependencies
This article describes different types of dependencies in package.json ... Marking a peer dependency as optional ensures npm will not emit a warning...
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 Free
Top 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
Ok thanks.
A better alternative (to my previous solution) is to use Yarn workspaces:
Note:
./src/package.json
remains unchanged, see https://github.com/benmosher/eslint-plugin-import/issues/1272#issue-403798133.This does not require to install/re-install the local
src
folder after every change.And it works with. It does not work. Use relative paths as suggested by @ljharb.eslint-plugin-import
pluginMore details here (Stackoverflow).
I threw a small Node project on my laptop and @ljharb is right, it does not seem to work outside of
node_modules
.The fact that it works when bundling a RN app, must be RN specific then.
I’ll find an alternative, thanks for your help.