import/group-exports
eslint-plugin-import
No autofix
eslint.config.js
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/group-exports": "error",
},
},
];Prefer named exports to be grouped together in a single export declaration
// Multiple named export statements -> not ok!
export const first = true
export const second = true// Aggregating exports from the same module -> not ok!
export { module1 } from 'module-1'
export { module2 } from 'module-1'// Multiple exports assignments -> not ok!
exports.first = true
exports.second = true// A single named export declaration -> ok
export const valid = trueconst first = true
const second = true
// A single named export declaration -> ok
export {
first,
second,
}// Aggregating exports -> ok
export { default as module1 } from 'module-1'
export { default as module2 } from 'module-2'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/group-exports
eslint-plugin-import
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/group-exports": "error",
},
},
];import/group-exports
import plugin · style
{
"plugins": [
"import"
],
"rules": {
"import/group-exports": "error"
}
}Biome does not have this rule.
Enforce the maximum number of dependencies a module can have.
Forbid importing modules from parent directories.
Forbid potentially ambiguous parse goal (script vs. module).
Enforce either using, or omitting, the node: protocol when importing Node.js builtin modules.