no-invalid-html-attribute
Added in v0.9.1Configuration
Rule Details
This rule disallows invalid values for selected HTML attributes. By default, it
validates rel values on HTML JSX elements and React.createElement calls.
It reports values that are unknown, used on the wrong element, not separated by
single spaces, or used without a required companion value.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
The rule accepts one positional array listing the attributes to validate. The
only supported attribute is rel; omitting the option is equivalent to
selecting rel.
Examples of correct code for this rule with no selected attributes:
Differences from ESLint
For React.createElement calls, rslint only validates rel values that are
string literals. Numeric, BigInt, boolean, null, and RegExp literals are not
sent through the string-value lookup or suggestion path:
This intentionally differs from eslint-plugin-react v7.37.5. Its
checkPropValidValue branch treats every ESTree Literal as though
value.value were a string. That can produce malformed suggestions such as
rel: for a number or rel: // for a RegExp. rslint skips these non-string
values so suggestions never produce syntactically invalid code.