# no-namespace

Rule `import/no-namespace`. Forbid namespace (a.k.a. "wildcard" `*`) imports.

- Source: import
- Technologies: Imports
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1729 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/no-namespace` | no | safe | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/no-namespace.md) |
| Oxlint | `import/no-namespace` | no | no | plugin `import`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/import/no-namespace.html) |

## Code examples

### Incorrect: the rule reports this

```js
import * as foo from 'foo';
```

```js
import defaultExport, * as foo from 'foo';
```

### Correct: the rule accepts this

```js
import defaultExport from './foo'
import { a, b }  from './bar'
import defaultExport, { a, b }  from './foobar'
```

```js
import * as bar from './ignored-module.ext';
```

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

### Oxlint: `.oxlintrc.json`

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

## Related rules

- [typescript/no-namespace](https://lintradar.dev/rules/typescript/no-namespace.md): Disallow TypeScript namespaces
- [react/no-namespace](https://lintradar.dev/rules/react/no-namespace.md): Enforce that namespaces are not used in React elements
- [import/no-named-export](https://lintradar.dev/rules/import/no-named-export.md): Forbid named exports.
- [import/no-relative-parent-imports](https://lintradar.dev/rules/import/no-relative-parent-imports.md): Forbid importing modules from parent directories.
- [import/max-dependencies](https://lintradar.dev/rules/import/max-dependencies.md): Enforce the maximum number of dependencies a module can have.
- [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-namespace. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
