import/exports-last
eslint-plugin-import
No autofix
eslint.config.js
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/exports-last": "error",
},
},
];const bool = true
export default bool
const str = 'foo'export const bool = true
const str = 'foo'const arr = ['bar']
export const bool = true
export default bool
export function func() {
console.log('Hello World 🌍')
}
export const str = 'foo'Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
import/exports-last
eslint-plugin-import
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/exports-last": "error",
},
},
];import/exports-last
import plugin · style
{
"plugins": [
"import"
],
"rules": {
"import/exports-last": "error"
}
}style/useExportsLast
style · since 2.0.0
{
"linter": {
"rules": {
"style": {
"useExportsLast": "error"
}
}
}
}Forbid CommonJS require calls and module.exports or exports.*.
Prefer named exports to be grouped together in a single export declaration
Enforce the maximum number of dependencies a module can have.