import-js/eslint-plugin-import
Vedi su GitHubimport/no-unresolved errors if package omits `.js` extension in `main`
Open
#617 aperta il 9 ott 2016
bughelp wanted
Metriche repository
- Star
- (4946 star)
- Metriche merge PR
- (Merge medio 138g 22h) (3 PR mergiate in 30 g)
Descrizione
If a dependency (for instance, a package in node_modules) omits an extension in the main field of its package.json, the import/no-unresolved rule will fail.
For example:
// node_modules/foo/package.json
{
name: "foo",
version: "1.0.0",
main: "index"
}
// node_modules/foo/index.js
const message = 'It is legal to omit a .js on "main" in package.json';
export default message;
// index.js
import foo from 'foo'; // This triggers the import/no-unresolved rule
console.log(foo);
I imagine this should be a simple fix.