jsx_a11y/prefer-tag-over-role Correctness ​
What it does ​
Enforces using semantic HTML tags over role
attribute.
Why is this bad? ​
Using semantic HTML tags can improve accessibility and readability of the code.
Example ​
Examples of incorrect code for this rule:
jsx
<div role="button" />
Examples of correct code for this rule:
jsx
<button />
How to use ​
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny jsx-a11y/prefer-tag-over-role --jsx-a11y-plugin
json
{
"plugins": ["jsx-a11y"],
"rules": {
"jsx-a11y/prefer-tag-over-role": "error"
}
}