DocumentationRulesno-namespace

no-namespace

Full Name in eslint-plugin-react-dom

react-dom/no-namespace

Full Name in @eslint-react/eslint-plugin

@eslint-react/dom/no-namespace

Features

🔍

Presets

  • dom
  • recommended
  • recommended-typescript
  • recommended-type-checked

What it does

Enforces the absence of a namespace in React elements.

Why is this bad?

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

Examples

Failing

import React from "react";
 
function Example() {
  return (
    <svg:circle
      cx="50"
      cy="50"
      r="40"
      stroke="black"
      stroke-width="3"
      fill="red"
    />
  );
}

Passing

import React from "react";
 
function Example() {
  return (
    <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
  );
}