# exports-style

Rule `node/exports-style`. Enforce either `module.exports` or `exports`

- Source: node
- Technologies: Node.js
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 2.1M weekly downloads of presets that enable it
- Trend: +151.7% last quarter
- Rank: #1520 by reach, #24 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `n/exports-style` | no | safe | package `eslint-plugin-n` | [docs](https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/exports-style.md) |
| Oxlint | `node/exports-style` | no | no | plugin `node`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/node/exports-style.html) |

## Code examples

### Incorrect: the rule reports this

```js
exports.foo = 1
exports.bar = 2
```

```js
module.exports = {
    foo: 1,
    bar: 2
}

module.exports.baz = 3
```

### Correct: the rule accepts this

```js
module.exports = {
    foo: 1,
    bar: 2
}

module.exports.baz = 3
```

```js
exports.foo = 1
exports.bar = 2
```

```js
// Allow `module.exports` in the same assignment expression as `exports`.
module.exports = exports = function foo() {
    // do something.
}

exports.bar = 1
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import n from "eslint-plugin-n";

export default [
  {
    plugins: { n },
    rules: {
      "n/exports-style": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "node"
  ],
  "rules": {
    "node/exports-style": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |

## Related rules

- [node/callback-return](https://lintradar.dev/rules/node/callback-return.md): Require `return` statements after callbacks
- [node/global-require](https://lintradar.dev/rules/node/global-require.md): Require `require()` calls to be placed at top-level module scope
- [node/no-mixed-requires](https://lintradar.dev/rules/node/no-mixed-requires.md): Disallow `require` calls to be mixed with regular variable declarations
- [node/file-extension-in-import](https://lintradar.dev/rules/node/file-extension-in-import.md): Enforce the style of file extensions in `import` declarations
- [node/no-unpublished-bin](https://lintradar.dev/rules/node/no-unpublished-bin.md): Disallow `bin` files that npm ignores
- [node/prefer-process-get-builtin-module](https://lintradar.dev/rules/node/prefer-process-get-builtin-module.md): Enforce using `process.getBuiltinModule()` to load Node.js built-in modules

---

Web page: https://lintradar.dev/rules/node/exports-style. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
