mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(linter): shorten code in jsx_a11y/aria_activedescendant_has_tabindex rule (#5340)
Shorten code which was introduced in #5223.
This commit is contained in:
parent
0de844d23c
commit
57050ab16a
1 changed files with 6 additions and 16 deletions
|
|
@ -82,22 +82,12 @@ impl Rule for AriaActivedescendantHasTabindex {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
match &jsx_opening_el.name {
|
let (name, span) = match &jsx_opening_el.name {
|
||||||
JSXElementName::Identifier(identifier) => {
|
JSXElementName::Identifier(id) => (id.name.as_str(), id.span),
|
||||||
ctx.diagnostic(aria_activedescendant_has_tabindex_diagnostic(
|
JSXElementName::IdentifierReference(id) => (id.name.as_str(), id.span),
|
||||||
identifier.span,
|
_ => return,
|
||||||
identifier.name.as_str(),
|
};
|
||||||
));
|
ctx.diagnostic(aria_activedescendant_has_tabindex_diagnostic(span, name));
|
||||||
}
|
|
||||||
|
|
||||||
JSXElementName::IdentifierReference(identifier_reference) => {
|
|
||||||
ctx.diagnostic(aria_activedescendant_has_tabindex_diagnostic(
|
|
||||||
identifier_reference.span,
|
|
||||||
identifier_reference.name.as_str(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue