# namespace

Rule `import/namespace`. Ensure imported namespaces contain dereferenced properties as they are dereferenced.

- Source: import
- Technologies: Imports
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 110.8M weekly downloads of presets that enable it
- Trend: +48.5% last quarter
- Rank: #144 by reach, #857 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/namespace` | yes | no | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/namespace.md) |
| Oxlint | `import/namespace` | no | no | plugin `import`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/import/namespace.html) |
| Biome | `nursery/useValidNamespaceImports` | yes | no | group nursery, since 2.6.8 | [docs](https://biomejs.dev/linter/rules/use-valid-namespace-imports/) |

## Code examples

### Correct: the rule accepts this

```js
// @module ./foo
import * as names from './named-exports'

function great() {
  return names.a + names.b  // so great https://youtu.be/ei7mb8UxEl8
}

function notGreat() {
  doSomethingWith(names.c) // Reported: 'c' not found in imported namespace 'names'.

  const { a, b, c } = names // also reported, only for 'c'
}

// also tunnels through re-exported namespaces!
function deepTrouble() {
  doSomethingWith(names.deep.e) // fine
  doSomethingWith(names.deep.f) // Reported: 'f' not found in deeply imported namespace 'names.deep'.
}
```

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

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "import"
  ],
  "rules": {
    "import/namespace": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "useValidNamespaceImports": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [import recommended](https://lintradar.dev/presets/import-recommended.md) | ESLint | `eslint-plugin-import` | 8 | 80.3M | +33.7% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [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% |

## Related rules

- [import/default](https://lintradar.dev/rules/import/default.md): Ensure a default export is present, given a default import.
- [import/export](https://lintradar.dev/rules/import/export.md): Forbid any invalid exports, i.e. re-export of the same name.
- [import/no-duplicates](https://lintradar.dev/rules/import/no-duplicates.md): Forbid repeated import of the same module in multiple places.
- [import/no-named-as-default](https://lintradar.dev/rules/import/no-named-as-default.md): Forbid use of exported name as identifier of default export.
- [import/no-named-as-default-member](https://lintradar.dev/rules/import/no-named-as-default-member.md): Forbid use of exported name as property of default export.
- [import/named](https://lintradar.dev/rules/import/named.md): Ensure named imports correspond to a named export in the remote file.

---

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