import-js/eslint-plugin-import

`eslint-plugin-import` breaks `eslint` if no `package.json`-file is present

Open

#2096 aperta il 24 mag 2021

Vedi su GitHub
 (27 commenti) (0 reazioni) (0 assegnatari)JavaScript (1540 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (4946 star)
Metriche merge PR
 (Merge medio 138g 22h) (3 PR mergiate in 30 g)

Descrizione

If there is no package.json-file in the file to check (or any parent directory), the eslint-run fails due to this piece of code: https://github.com/benmosher/eslint-plugin-import/blob/802ce7d49d912289d590f735bf9bd2d931064863/src/core/packagePath.js#L11-L12

Following error is reported:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
Occurred while linting {filename}.js

Guida contributor