---
url: /docs/guide/usage/linter/rules/node/exports-style.md
---

### What it does

Enforce either `module.exports` or `exports`.

### Why is this bad?

`module.exports` and `exports` are the same instance by default. But those come to be different if one of them is modified.

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

exports.bar = 2;
```

In this case, `exports.bar` will be lost since only the instance of `module.exports` will be exported.

### Examples

Examples of **incorrect** code for the `"module.exports"` option:

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

Examples of **correct** code for the `"module.exports"` option:

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

Examples of **incorrect** code for the `"exports"` option:

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

Examples of **correct** code for the `"exports"` option:

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

## Configuration

### The 1st option

type: `"module.exports" | "exports"`

#### `"module.exports"`

Requires `module.exports` and disallows `exports`

#### `"exports"`

Requires `exports` and disallows `module.exports`

### The 2nd option

This option is an object with the following properties:

#### allowBatchAssign

type: `boolean`

default: `false`

If this option is set to `true`, `module.exports = exports = obj` are allowed.

## How to use

## Version

This rule was added in v1.76.0.

## References
