Skip to content

Commit

Permalink
refactor(linter): shorten code in `jsx_a11y/aria_activedescendant_has…
Browse files Browse the repository at this point in the history
…_tabindex` rule (#5340)

Shorten code which was introduced in #5223.
  • Loading branch information
overlookmotel committed Aug 30, 2024
1 parent 0de844d commit 57050ab
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,12 @@ impl Rule for AriaActivedescendantHasTabindex {
return;
}

match &jsx_opening_el.name {
JSXElementName::Identifier(identifier) => {
ctx.diagnostic(aria_activedescendant_has_tabindex_diagnostic(
identifier.span,
identifier.name.as_str(),
));
}

JSXElementName::IdentifierReference(identifier_reference) => {
ctx.diagnostic(aria_activedescendant_has_tabindex_diagnostic(
identifier_reference.span,
identifier_reference.name.as_str(),
));
}
_ => {}
}
let (name, span) = match &jsx_opening_el.name {
JSXElementName::Identifier(id) => (id.name.as_str(), id.span),
JSXElementName::IdentifierReference(id) => (id.name.as_str(), id.span),
_ => return,
};
ctx.diagnostic(aria_activedescendant_has_tabindex_diagnostic(span, name));
}
}

Expand Down

0 comments on commit 57050ab

Please sign in to comment.