Rule `import/no-unresolved` raise false positive when there is no `main` field in the `package.json`
#2.132 aberto em 19 de jun. de 2021
Métricas do repositório
- Stars
- (4.946 stars)
- Métricas de merge de PR
- (Mesclagem média 138d 22h) (3 fundiu PRs em 30d)
Description
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
import GBAEmulator, { GbaContext } from 'react-gbajs'
./node_modules/.bin/eslint .
What did you expect to happen?
Should raise no error. This package is present in the node_modules.
An important note:
Since it's only for the browser, it has the field browser instead of main in its package.json (link). I made it following the NPM documentation.
Despite that, I noticed that by adding the field main in its package.json, the error suppress - but it doesn't look correct.
What actually happened? Please copy-paste the actual, raw output from ESLint.
/Users/macabeus/ApenasMeu/klo-gba.js/brush/src/components/Emulator/index.js
2:41 error Unable to resolve path to module 'react-gbajs' import/no-unresolved
/Users/macabeus/ApenasMeu/klo-gba.js/brush/src/components/KloGbaSidebar/Hacks/index.js
7:28 error Unable to resolve path to module 'react-gbajs' import/no-unresolved
/Users/macabeus/ApenasMeu/klo-gba.js/brush/src/hooks/useGbaSaveRestoreState.js
2:28 error Unable to resolve path to module 'react-gbajs' import/no-unresolved
/Users/macabeus/ApenasMeu/klo-gba.js/brush/src/index.js
8:29 error Unable to resolve path to module 'react-gbajs' import/no-unresolved
/Users/macabeus/ApenasMeu/klo-gba.js/brush/src/providers/VisionProvider.js
4:28 error Unable to resolve path to module 'react-gbajs' import/no-unresolved
✖ 5 problems (5 errors, 0 warnings)
✨ Done in 4.73s.
Steps to reproduce this issue:
- Clone this repository: https://github.com/macabeus/klo-gba.js
- Run
yarnon its root cd brushyarn run lint