# no-import-module-exports

Rule `import/no-import-module-exports`. Forbid import statements with CommonJS module.exports.

- Source: import
- Technologies: Imports
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +2.2% last quarter
- Rank: #1108 by reach, #1615 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/no-import-module-exports` | no | safe | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import) |

## Code examples

### Incorrect: the rule reports this

```js
import { stuff } from 'starwars'
module.exports = thing

import * as allThings from 'starwars'
exports.bar = thing

import thing from 'other-thing'
exports.foo = bar

import thing from 'starwars'
const baz = module.exports = thing
console.log(baz)
```

### Correct: the rule accepts this

```js
import thing from 'other-thing'
export default thing

const thing = require('thing')
module.exports = thing

const thing = require('thing')
exports.foo = bar

import thing from 'otherthing'
console.log(thing.module.exports)

// in lib/index.js
import foo from 'path';
module.exports = foo;

// in some-file.js
// eslint import/no-import-module-exports: ["error", {"exceptions": ["**/*/some-file.js"]}]
import foo from 'path';
module.exports = foo;
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { import: importPlugin },
    rules: {
      "import/no-import-module-exports": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |

## Related rules

- [import/no-relative-packages](https://lintradar.dev/rules/import/no-relative-packages.md): Forbid importing packages through relative paths.
- [import/prefer-default-export](https://lintradar.dev/rules/import/prefer-default-export.md): Prefer a default export if module exports a single name or multiple names.
- [import/no-dynamic-require](https://lintradar.dev/rules/import/no-dynamic-require.md): Forbid `require()` calls with expressions.
- [import/order](https://lintradar.dev/rules/import/order.md): Enforce a convention in module import order.
- [import/no-useless-path-segments](https://lintradar.dev/rules/import/no-useless-path-segments.md): Forbid unnecessary path segments in import and require statements.
- [import/extensions](https://lintradar.dev/rules/import/extensions.md): Ensure consistent use of file extension within the import path.

---

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