import/group-exports Style ​
What it does ​
Reports when named exports are not grouped together in a single export declaration or when multiple assignments to CommonJS module.exports or exports object are present in a single file.
Why is this bad? ​
An export declaration or module.exports assignment can appear anywhere in the code. By requiring a single export declaration all your exports will remain at one place, making it easier to see what exports a module provides.
Examples ​
Examples of incorrect code for this rule:
js
export const first = true;
export const second = true;
Examples of correct code for this rule:
js
const first = true;
const second = true;
export { first, second };
How to use ​
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny import/group-exports --import-plugin
json
{
"plugins": ["import"],
"rules": {
"import/group-exports": "error"
}
}