jsx-a11y/prefer-tag-over-role Correctness
What it does
Enforces the use of semantic HTML tags instead of the role attribute.
Why is this bad?
Using semantic HTML tags can improve accessibility and code readability.
Examples
The following is an incorrect code example for this rule:
jsx
<div role="button" />The following is an correct code example for this rule:
jsx
<button />How to use
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["jsx-a11y"],
"rules": {
"jsx-a11y/prefer-tag-over-role": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["jsx-a11y"],
rules: {
"jsx-a11y/prefer-tag-over-role": "error",
},
});bash
oxlint --deny jsx-a11y/prefer-tag-over-role --jsx-a11y-pluginVersion
This rule was added in v0.1.1.
