react/no-unknown-property Restriction
What it does
Disallow usage of unknown DOM property.
Why is this bad?
You can use unknown property name that has no effect.
Examples
Examples of incorrect code for this rule:
jsx
// Unknown properties
const Hello = <div class="hello">Hello World</div>;
const Alphabet = <div abc="something">Alphabet</div>;
// Invalid aria-* attribute
const IconButton = <div aria-foo="bar" />;
Examples of correct code for this rule:
jsx
// Unknown properties
const Hello = <div className="hello">Hello World</div>;
const Alphabet = <div>Alphabet</div>;
// Invalid aria-* attribute
const IconButton = <div aria-label="bar" />;
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny react/no-unknown-property --react-plugin
json
{
"plugins": ["react"],
"rules": {
"react/no-unknown-property": "error"
}
}