# import/group-exports

> Require all named exports to be in a single `export` declaration

When `export` is written on many declarations, you have to scan the whole file to learn what it exports. One `export { }` list, or one assignment to `module.exports`, shows it in one place.

As soon as there are two exports, each of them is reported. Values, types (`export type`) and re-exports from each module (`export { } from`) are counted separately. A default export doesn't count.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"import/group-exports" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 2} */}
```js
export const retries = 3;

export function wait(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}
```

{/* bad {"count": 2} */}
```js
export { parse } from "./json.js";
export { stringify } from "./json.js";
```

{/* bad {"count": 2} */}
```js
exports.retries = 3;
module.exports.wait = ms => new Promise(resolve => setTimeout(resolve, ms));
```

Not reported:

{/* good */}
```js
const retries = 3;

function wait(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

export { retries, wait };
export default wait;
```

{/* good */}
```js
export { parse, stringify } from "./json.js";
export { encode } from "./base64.js";
```

{/* good */}
```js
const retries = 3;
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));

module.exports = { retries, wait };
```

{/* good */}
```ts
interface Options {
  retries: number;
}
const defaults: Options = { retries: 3 };

export { defaults };
export type { Options };
```
