# react/no-unknown-property 📝 Disallow usage of unknown DOM property. 💼 This rule is enabled in the ☑️ `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). 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. ## Rule Details Examples of **incorrect** code for this rule: ```jsx var React = require('react'); var Hello =
Hello World
; var Alphabet =
Alphabet
; // Invalid aria-* attribute var IconButton =
; ``` Examples of **correct** code for this rule: ```jsx var React = require('react'); var Hello =
Hello World
; var Button = ; var Img = A cat sleeping on a keyboard; // aria-* attributes var IconButton = ; // data-* attributes var Data =
Some data
; // React components are ignored var MyComponent = ; var AnotherComponent = ; // Custom web components are ignored var MyElem =
; var AtomPanel = ; ``` ## Rule Options ```js ... "react/no-unknown-property": [, { ignore: , requireDataLowercase: }] ... ``` - `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 the `requireDataLowercase` option to `true`. 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](https://emotion.sh/docs/introduction) and its [`css` prop](https://emotion.sh/docs/css-prop), add the following to your `.eslintrc` config file: ```js ... "react/no-unknown-property": ['error', { ignore: ['css'] }] ... ``` Now, the following code passes: ```jsx var StyledDiv =
; ``` ## When Not To Use It If you are not using JSX you can disable this rule.