# no-import-assign

Rule `eslint/no-import-assign`. Disallow assigning to imported bindings

- Source: eslint
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 273.4M weekly downloads of presets that enable it
- Trend: +46.1% last quarter
- Rank: #40 by reach, #880 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-import-assign` | yes | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-import-assign) |
| Oxlint | `no-import-assign` | yes | no | plugin `eslint`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-import-assign.html) |
| Biome | `suspicious/noImportAssign` | yes | no | group suspicious, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-import-assign/) |

## Code examples

### Incorrect: the rule reports this

```js
import mod, { named } from "./mod.mjs"
import * as mod_ns from "./mod.mjs"

mod = 1          // ERROR: 'mod' is readonly.
named = 2        // ERROR: 'named' is readonly.
mod_ns.named = 3 // ERROR: The members of 'mod_ns' are readonly.
mod_ns = {}      // ERROR: 'mod_ns' is readonly.
// Can't extend 'mod_ns'
Object.assign(mod_ns, { foo: "foo" }) // ERROR: The members of 'mod_ns' are readonly.
```

### Correct: the rule accepts this

```js
import mod, { named } from "./mod.mjs"
import * as mod_ns from "./mod.mjs"

mod.prop = 1
named.prop = 2
mod_ns.named.prop = 3

// Known Limitation
function test(obj) {
    obj.named = 4 // Not errored because 'obj' is not namespace objects.
}
test(mod_ns) // Not errored because it doesn't know that 'test' updates the member of the argument.
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "no-import-assign": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-import-assign": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "suspicious": {
        "noImportAssign": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [ESLint recommended](https://lintradar.dev/presets/eslint-recommended.md) | ESLint | `@eslint/js` | 64 | 178.8M | +25.9% |
| [Oxlint default](https://lintradar.dev/presets/oxlint-default.md) | Oxlint | `oxlint` | 111 | 50.8M | +183.6% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [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% |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [eslint/no-class-assign](https://lintradar.dev/rules/eslint/no-class-assign.md): Disallow reassigning class members
- [eslint/for-direction](https://lintradar.dev/rules/eslint/for-direction.md): Enforce `for` loop update clause moving the counter in the right direction
- [eslint/no-unused-vars](https://lintradar.dev/rules/eslint/no-unused-vars.md): Disallow unused variables
- [eslint/no-dupe-else-if](https://lintradar.dev/rules/eslint/no-dupe-else-if.md): Disallow duplicate conditions in if-else-if chains
- [eslint/constructor-super](https://lintradar.dev/rules/eslint/constructor-super.md): Require `super()` calls in constructors
- [eslint/no-nonoctal-decimal-escape](https://lintradar.dev/rules/eslint/no-nonoctal-decimal-escape.md): Disallow `\8` and `\9` escape sequences in string literals

---

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