Skip to content

react/no-namespace Suspicious ​

What it does ​

Enforce that namespaces are not used in React elements.

Why is this bad? ​

Namespaces in React elements, such as svg:circle, are not supported by React.

Examples ​

Examples of incorrect code for this rule:

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

Examples of correct code for this rule:

jsx
<TestComponent />
<testComponent />

How to use ​

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny react/no-namespace
json
{
  "rules": {
    "react/no-namespace": "error"
  }
}

References ​

Released under the MIT License.