diff --git a/crates/oxc_linter/src/rules/jsx_a11y/no_redundant_roles.rs b/crates/oxc_linter/src/rules/jsx_a11y/no_redundant_roles.rs index 481220df075ac..8a03867f0f315 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/no_redundant_roles.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/no_redundant_roles.rs @@ -44,11 +44,11 @@ declare_oxc_lint!( /// ``` NoRedundantRoles, correctness, - pending + fix ); static DEFAULT_ROLE_EXCEPTIONS: phf::Map<&'static str, &'static str> = phf_map! { - "nav" =>"navigation", + "nav" => "navigation", "button" => "button", "body" => "document", }; @@ -69,9 +69,10 @@ impl Rule for NoRedundantRoles { for role in &roles { let exceptions = DEFAULT_ROLE_EXCEPTIONS.get(&component); if exceptions.map_or(false, |set| set.contains(role)) { - ctx.diagnostic(no_redundant_roles_diagnostic( - attr.span, &component, role, - )); + ctx.diagnostic_with_fix( + no_redundant_roles_diagnostic(attr.span, &component, role), + |fixer| fixer.delete_range(attr.span), + ); } } } @@ -109,5 +110,10 @@ fn test() { ("