# no-namespace

Rule `react/no-namespace`. Enforce that namespaces are not used in React elements

- Source: react
- Technologies: React
- Kind: suspicious
- Needs type information: no
- Autofix: no
- Reach: 3.4M weekly downloads of presets that enable it
- Trend: +2.6% last quarter
- Rank: #1421 by reach, #1557 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/no-namespace` | no | no | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/no-namespace.md) |
| Oxlint | `react/no-namespace` | no | no | plugin `react`, category suspicious | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/no-namespace.html) |

## Code examples

### Incorrect: the rule reports this

```jsx
<ns:TestComponent />
<Ns:TestComponent />
```

### Correct: the rule accepts this

```jsx
<TestComponent />
<testComponent />
```

Examples from the Oxlint documentation.

## Enable it

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

```js
import react from "eslint-plugin-react";

export default [
  {
    plugins: { react },
    rules: {
      "react/no-namespace": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [typescript/no-namespace](https://lintradar.dev/rules/typescript/no-namespace.md): Disallow TypeScript namespaces
- [import/no-namespace](https://lintradar.dev/rules/import/no-namespace.md): Forbid namespace (a.k.a. "wildcard" `*`) imports.
- [react/jsx-no-constructed-context-values](https://lintradar.dev/rules/react/jsx-no-constructed-context-values.md): Disallows JSX context provider values from taking values that will cause needless rerenders
- [react/no-redundant-should-component-update](https://lintradar.dev/rules/react/no-redundant-should-component-update.md): Disallow usage of shouldComponentUpdate when extending React.PureComponent
- [react/jsx-no-script-url](https://lintradar.dev/rules/react/jsx-no-script-url.md): Disallow usage of `javascript:` URLs
- [react/no-this-in-sfc](https://lintradar.dev/rules/react/no-this-in-sfc.md): Disallow `this` from being used in stateless functional components

---

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