no-namespace
Rule category
Correctness.
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 function Example(): React.JSX.Element
Example() {
return (
<JSX.IntrinsicElements.circle: React.SVGProps<SVGCircleElement>
circle React.SVGAttributes<SVGCircleElement>.cx?: string | number | undefined
cx="50" React.SVGAttributes<SVGCircleElement>.cy?: string | number | undefined
cy="50" React.SVGAttributes<SVGCircleElement>.r?: string | number | undefined
r="40" React.SVGAttributes<SVGCircleElement>.stroke?: string | undefined
stroke="black" stroke-width: string
stroke-width="3" React.SVGAttributes<SVGCircleElement>.fill?: string | undefined
fill="red" />
);
}