# no-restricted-imports

Rule `typescript/no-restricted-imports`. Disallow specified modules when loaded by `import`

- Source: typescript
- Technologies: TypeScript
- Kind: style
- Needs type information: no
- Autofix: no
- Deprecated: yes
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1706 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/no-restricted-imports` | no | no | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/no-restricted-imports) |
| Biome | `style/noRestrictedImports` | no | no | group style, since 1.6.0 | [docs](https://biomejs.dev/linter/rules/no-restricted-imports/) |

## Code examples

### Incorrect: the rule reports this

```ts
import foo from 'import-foo';
export { Foo } from 'import-foo';

import baz from 'import-baz';
export { Baz } from 'import-baz';
```

### Correct: the rule accepts this

```ts
import { foo } from 'other-module';

import type foo from 'import-foo';
export type { Foo } from 'import-foo';

import type baz from 'import-baz';
export type { Baz } from 'import-baz';
```

Examples from the ESLint documentation.

## Enable it

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

```js
import tseslint from "typescript-eslint";

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/no-restricted-imports": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noRestrictedImports": "error"
      }
    }
  }
}
```

## Related rules

- [eslint/no-restricted-imports](https://lintradar.dev/rules/eslint/no-restricted-imports.md): Disallow specified modules when loaded by `import`
- [typescript/prefer-readonly-parameter-types](https://lintradar.dev/rules/typescript/prefer-readonly-parameter-types.md): Require function parameters to be typed as `readonly` to prevent accidental mutation of inputs
- [typescript/explicit-module-boundary-types](https://lintradar.dev/rules/typescript/explicit-module-boundary-types.md): Require explicit return and argument types on exported functions' and classes' public class methods
- [typescript/no-invalid-this](https://lintradar.dev/rules/typescript/no-invalid-this.md): Disallow `this` keywords outside of classes or class-like objects
- [typescript/member-ordering](https://lintradar.dev/rules/typescript/member-ordering.md): Require a consistent member declaration order
- [typescript/init-declarations](https://lintradar.dev/rules/typescript/init-declarations.md): Require or disallow initialization in variable declarations

---

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