Skip to main content
interlace
Plugin: import-nextRules

group-exports

Prefer named exports to be grouped together in a single export declaration

💼 This rule is enabled in the following configs: recommended, typescript.

Rule Details

Export lists scattered across a file make its public surface hard to see. This rule reports a second export list where one statement would do:

  • two local lists, export { a }; export { b };
  • two re-export lists from the same module, export { a } from './m'; export { b } from './m';

Type-only lists group separately from value lists: export { a } next to export type { T } is not reported, since merging them takes inline type modifiers, a style choice this rule does not make. Two type-only lists are reported.

Inline declaration exports (export const x = 1), export default, export * from and re-exports from different modules are not lists to merge. CommonJS module.exports assignments are not checked.

❌ Incorrect

export { a };
export { b };

export { c } from './m';
export { d } from './m';

export type { T };
export type { U };

✅ Correct

export { a, b };
export { c, d } from './m';
export type { T, U };

export { e };
export type { V };

Options

[]

No options.

When Not To Use It

When you prefer each export statement next to the code it exports.

Use this rule

npm install -D oxlint-plugin-import-next
.oxlintrc.json
{  "jsPlugins": ["oxlint-plugin-import-next"],  "rules": {    "import-next/group-exports": "error"  }}
vite.config.ts
import { defineConfig } from 'vite-plus';export default defineConfig({  lint: {    jsPlugins: ['oxlint-plugin-import-next'],    rules: {      'import-next/group-exports': 'error',    },  },});

oxlint-plugin-import-next re-exports eslint-plugin-import-next/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.

Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.