Skip to content

noUnknownAttribute

biome.json
{
"linter": {
"rules": {
"nursery": {
"noUnknownAttribute": "error"
}
}
}
}

Disallow unknown DOM properties.

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 allowed to use hyphens and lowercase letters in JSX.

<div allowTransparency="true" />
code-block.jsx:1:6 lint/nursery/noUnknownAttribute ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The property ‘allowTransparency’ is not a valid DOM attribute.

> 1 │ <div allowTransparency=“true” />
^^^^^^^^^^^^^^^^^^^^^^^^
2 │

This property is not recognized as a valid HTML/DOM attribute or React prop.

Check the spelling or consider using a valid data-* attribute for custom properties.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<div onclick={() => {}} />
code-block.jsx:1:6 lint/nursery/noUnknownAttribute ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Property ‘onclick’ is not a valid React prop name.

> 1 │ <div onclick={() => {}} />
^^^^^^^^^^^^^^^^^^
2 │

React uses camelCased props, while HTML uses kebab-cased attributes.

Use ‘onClick’ instead of ‘onclick’ for React components.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<div for="bar" />
code-block.jsx:1:6 lint/nursery/noUnknownAttribute ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Property ‘for’ is not a valid React prop name.

> 1 │ <div for=“bar” />
^^^^^^^^^
2 │

React uses camelCased props, while HTML uses kebab-cased attributes.

Use ‘htmlFor’ instead of ‘for’ for React components.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<div className="foo" />
<div onClick={() => {}} />
<div htmlFor="bar" />
<div data-foo="bar" />
<div aria-label="Close" />

An array of property and attribute names to ignore during validation.

{
"noUnknownAttribute": {
"options": {
"ignore": ["custom-attribute", "non-standard-prop"]
}
}
}