import/named
eslint-plugin-import
No autofixRecommended
eslint.config.js
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/named": "error",
},
},
];The documentation shows no incorrect example for this rule.
// ./bar.js
import { foo } from './foo'
// ES7 proposal
export { foo as bar } from './foo'
// node_modules without jsnext:main are not analyzed by default
// (import/ignore setting)
import { SomeNonsenseThatDoesntExist } from 'react'// ./baz.js
import { notFoo } from './foo'
// ES7 proposal
export { notFoo as defNotBar } from './foo'
// will follow 'jsnext:main', if available
import { dontCreateStore } from 'redux'Examples from the ESLint documentation.
import/named
eslint-plugin-import
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/named": "error",
},
},
];import/named
import plugin · nursery
{
"plugins": [
"import"
],
"rules": {
"import/named": "error"
}
}correctness/noUnresolvedImports
correctness · since 2.0.0
{
"linter": {
"rules": {
"correctness": {
"noUnresolvedImports": "error"
}
}
}
}Ensure imports point to a file/module that can be resolved.
Forbid use of exported name as property of default export.
Forbid use of exported name as identifier of default export.
Forbid repeated import of the same module in multiple places.
Forbid anonymous values as default exports.
Ensure imported namespaces contain dereferenced properties as they are dereferenced.