no-namespace
Disallow JSX namespace syntax, as React does not support them.
Full Name in eslint-plugin-react-jsx
react-jsx/no-namespaceFull Name in @eslint-react/eslint-plugin
@eslint-react/jsx-no-namespacePresets
jsx
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.
Examples
Using namespace tags in JSX
// Problem: Namespace tag — not supported by React.
<ns:testcomponent />// Problem: PascalCase namespace is also not allowed.
<Ns:TestComponent />// Problem: SVG-style namespace is also not allowed.
<svg:circle cx="50" cy="50" r="40" />Using standard JSX tags
// Recommended: Plain element — no namespace.
<testcomponent />// Recommended: Member expression — not a namespace.
<object.TestComponent />// Recommended: PascalCase component.
<TestComponent />