Open soullivaneuh opened 4 years ago
BTW, still without node_module, for some imports like this:
import palette from 'google-palette/palette.js';
I do have this correct error:
error Unexpected use of file extension "js" for "google-palette/palette.js" import/extensions
EDIT: If I remove the extension, I go eslint is still yelling that I should add one.
google-palette/palette.js
or google-palette/palette
are both valid paths depending on your extensions
config.
Similarly, moment/locale/fr
or moment/locale/fr.js
are both valid.
All of those are asking for a specific file inside a package. Imports from a package directly - like vue-moment
- are not asking for a file, they're asking for a package, so there'd never be an extension there.
Additionally, without node_modules
present (as it should be present for any development or linting on the project anyways), there's no way for us to know if moment/locale/fr
is a fr.js
file, or an fr/index.js
file, or an fr
dir with a package.json and a "main" - so it's reasonable to have different behavior when you've failed to run npm install
.
With the following import:
I have the following error when
node_modules
is not present:Not that I use eslint on a generic tools to be run accros project without repeting configuration.
The
import/no-unresolved
is automatically disable ifnode_modules
is not present: https://gitlab.com/nexylan/pretty/blob/9488bf414bf6394d7d12ccfc4071d674622427d2/tools/eslint/.eslintrc.js#L46-49But I don't
import/extensions
should be on error. BTW, I don't have any warning for other imports like this:I'm using v2.20.0, but I don't think there is any fix about this extension according to the changelog.