logoESLint React
Rules

no-namespace

Disallow JSX namespace syntax, as React does not support them.

Full Name in eslint-plugin-react-jsx

react-jsx/no-namespace

Full Name in @eslint-react/eslint-plugin

@eslint-react/jsx-no-namespace

Presets

recommended recommended-typescript recommended-type-checked strict strict-typescript strict-type-checked

Rule Details

React does not support XML namespaced tags (e.g. <ns:Component />). Although the JSX specification permits namespaces, React does not implement them. Using a namespaced element will cause a runtime error.

Invalid

// ❌ Namespace tag — not supported by React.
<ns:testcomponent />;
// ❌ PascalCase namespace is also not allowed.
<Ns:TestComponent />;
// ❌ SVG-style namespace is also not allowed.
<svg:circle cx="50" cy="50" r="40" />;

Valid

// ✅ Plain element — no namespace.
<testcomponent />;
// ✅ Member expression — not a namespace.
<object.TestComponent />;
// ✅ PascalCase component.
<TestComponent />;

Resources

Further Reading

On this page