node: v10.14.1
eslint: v5.10.0
eslint-plugin-import: v2.14.0
.eslintrc.js
module.exports = {
plugins: ['import'],
rules: {
'import/extensions': ['error', 'always', {
ignorePackages: true,
js: 'never',
}]
}
}
./src/index.js
Running eslint results in an error:
/Volumes/Projects/project/src/index.js
1:22 error Missing file extension "js" for "./app" import/extensions
The problem seems to be here https://github.com/benmosher/eslint-plugin-import/blob/1cd82eb27df85768fbd076e4ff6b7f36d6f652ce/src/rules/extensions.js#L36-L45
Plugin expects extensions overrides to be specified inside pattern property inside the options object if ignorePackages property is also specified. It's not documented here though.
So this configuration works correctly:
{
rules: {
'import/extensions': ['error', 'always', {
ignorePackages: true,
pattern: { // wrap extensions in the `pattern` object
js: 'never',
}
}]
}
}
Either documentation is lacking or pattern property should not be expected in options.
node: v10.14.1
eslint: v5.10.0
eslint-plugin-import: v2.14.0
.eslintrc.js
./src/index.js
Running eslint results in an error:
The problem seems to be here https://github.com/benmosher/eslint-plugin-import/blob/1cd82eb27df85768fbd076e4ff6b7f36d6f652ce/src/rules/extensions.js#L36-L45
Plugin expects extensions overrides to be specified inside
patternproperty inside the options object ifignorePackagesproperty is also specified. It's not documented here though.So this configuration works correctly:
Either documentation is lacking or
patternproperty should not be expected in options.