Rules
no-unknown-property
Full Name in eslint-plugin-react-dom
Full Name in @eslint-react/eslint-plugin
Features
🔍
🔧
⚙️
Presets
dom
recommended
What it does
In JSX most DOM properties and attributes should be camelCased to be consistent with standard JavaScript style. This can be a possible source of error if you are used to writing plain HTML.
Only data-*
and aria-*
attributes are usings hyphens and lowercase letters in JSX.
An unsafe auto-fix is available for this rule.
Examples
Failing
Passing
Rule Options
enabled
: for enabling the rule. 0=off, 1=warn, 2=error. Defaults to 0.ignore
: optional array of property and attribute names to ignore during validation.requireDataLowercase
: optional (default:false
), require data-* attributes to contain only lowercase characters. React will issue a warning when data-* attributes contain uppercase characters. In order to catch such attributes, set therequireDataLowercase
option totrue
.
If you are using a library that passes something as a prop to JSX elements, it is recommended to add those props to the ignored properties.
For example, if you use emotion and its css
prop,
add the following to your .eslintrc
config file:
Rule Options Examples
Now, the following code passes: