import/default
eslint-plugin-import
No autofixRecommended
eslint.config.js
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/default": "error",
},
},
];The documentation shows no incorrect example for this rule.
import foo from './foo'
// assuming 'node_modules' are ignored (true by default)
import someModule from 'some-module'import bar from './bar' // no default export found in ./bar
import baz from './baz' // no default export found in ./bazExamples from the ESLint documentation.
import/default
eslint-plugin-import
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/default": "error",
},
},
];import/default
import plugin · correctness
{
"plugins": [
"import"
],
"rules": {
"import/default": "error"
}
}nursery/noUnresolvedDefaultImport
nursery · since 2.6.7
{
"linter": {
"rules": {
"nursery": {
"noUnresolvedDefaultImport": "error"
}
}
}
}Ensure imported namespaces contain dereferenced properties as they are dereferenced.
Forbid any invalid exports, i.e. re-export of the same name.
Forbid repeated import of the same module in multiple places.
Forbid use of exported name as identifier of default export.
Forbid use of exported name as property of default export.
Ensure named imports correspond to a named export in the remote file.