# no-internal-modules

Rule `import/no-internal-modules`. Forbid importing the submodules of other modules.

- Source: import
- Technologies: Imports
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1889 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/no-internal-modules` | no | no | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/no-internal-modules.md) |

## Code examples

### Incorrect: the rule reports this

```js
/**
 *  in my-project/entry.js
 */

import { settings } from './app/index'; // Reaching to "./app/index" is not allowed
import userReducer from './reducer/user'; // Reaching to "./reducer/user" is not allowed
import configureStore from './redux/configureStore'; // Reaching to "./redux/configureStore" is not allowed

export { settings } from './app/index'; // Reaching to "./app/index" is not allowed
export * from './reducer/user'; // Reaching to "./reducer/user" is not allowed
```

```js
/**
 *  in my-project/entry.js
 */

import 'source-map-support/register';
import getUser from '../actions/getUser';

export * from 'source-map-support/register';
export getUser from '../actions/getUser';
```

### Correct: the rule accepts this

```js
/**
 *  in my-project/entry.js
 */

import 'source-map-support/register';
import { settings } from '../app';
import getUser from '../actions/getUser';

export * from 'source-map-support/register';
export { settings } from '../app';
```

```js
/**
 *  in my-project/entry.js
 */

import 'source-map-support';
import { getUser } from '../actions';

export * from 'source-map-support';
export { getUser } from '../actions';
```

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-internal-modules": "error",
    },
  },
];
```

## Related rules

- [import/no-restricted-paths](https://lintradar.dev/rules/import/no-restricted-paths.md): Enforce which files can be imported in a given folder.
- [import/dynamic-import-chunkname](https://lintradar.dev/rules/import/dynamic-import-chunkname.md): Enforce a leading comment with the webpackChunkName for dynamic imports.
- [import/no-unused-modules](https://lintradar.dev/rules/import/no-unused-modules.md): Forbid modules without exports, or exports without matching import in another module.
- [import/no-deprecated](https://lintradar.dev/rules/import/no-deprecated.md): Forbid imported names marked with `@deprecated` documentation tag.
- [import/enforce-node-protocol-usage](https://lintradar.dev/rules/import/enforce-node-protocol-usage.md): Enforce either using, or omitting, the `node:` protocol when importing Node.js builtin modules.
- [import/unambiguous](https://lintradar.dev/rules/import/unambiguous.md): Forbid potentially ambiguous parse goal (`script` vs. `module`).

---

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