noUnknownAttribute
Summary
Section titled “Summary”- Rule available since: 
v2.3.3 - Diagnostic Category: 
lint/nursery/noUnknownAttribute - This rule doesn’t have a fix.
 - The default severity of this rule is information.
 - This rule belongs to the following domains:
 - Sources:
- Same as 
react/no-unknown-property 
 - Same as 
 
How to configure
Section titled “How to configure”{  "linter": {    "rules": {      "nursery": {        "noUnknownAttribute": "error"      }    }  }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<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.
  
<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.
  
<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.
  
<div className="foo" /><div onClick={() => {}} /><div htmlFor="bar" /><div data-foo="bar" /><div aria-label="Close" />Options
Section titled “Options”ignore
Section titled “ignore”An array of property and attribute names to ignore during validation.
{  "noUnknownAttribute": {    "options": {      "ignore": ["custom-attribute", "non-standard-prop"]    }  }}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.