mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(linter): shorten Option syntax (#5735)
Use `Some` instead of `Option::Some`.
This commit is contained in:
parent
805fbac44c
commit
20a7861838
3 changed files with 3 additions and 5 deletions
|
|
@ -137,9 +137,7 @@ impl Rule for AnchorIsValid {
|
||||||
};
|
};
|
||||||
// Don't eagerly get `span` here, to avoid that work unless rule fails
|
// Don't eagerly get `span` here, to avoid that work unless rule fails
|
||||||
let get_span = || jsx_el.opening_element.name.span();
|
let get_span = || jsx_el.opening_element.name.span();
|
||||||
if let Option::Some(href_attr) =
|
if let Some(href_attr) = has_jsx_prop_ignore_case(&jsx_el.opening_element, "href") {
|
||||||
has_jsx_prop_ignore_case(&jsx_el.opening_element, "href")
|
|
||||||
{
|
|
||||||
let JSXAttributeItem::Attribute(attr) = href_attr else {
|
let JSXAttributeItem::Attribute(attr) = href_attr else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ impl Rule for AriaRole {
|
||||||
|
|
||||||
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
||||||
if let AstKind::JSXElement(jsx_el) = node.kind() {
|
if let AstKind::JSXElement(jsx_el) = node.kind() {
|
||||||
if let Option::Some(aria_role) = has_jsx_prop(&jsx_el.opening_element, "role") {
|
if let Some(aria_role) = has_jsx_prop(&jsx_el.opening_element, "role") {
|
||||||
let Some(element_type) = get_element_type(ctx, &jsx_el.opening_element) else {
|
let Some(element_type) = get_element_type(ctx, &jsx_el.opening_element) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ impl Rule for CatchErrorName {
|
||||||
.unwrap_or(&vec![])
|
.unwrap_or(&vec![])
|
||||||
.iter()
|
.iter()
|
||||||
.map(serde_json::Value::as_str)
|
.map(serde_json::Value::as_str)
|
||||||
.filter(std::option::Option::is_some)
|
.filter(Option::is_some)
|
||||||
.map(|x| CompactStr::from(x.unwrap()))
|
.map(|x| CompactStr::from(x.unwrap()))
|
||||||
.collect::<Vec<CompactStr>>();
|
.collect::<Vec<CompactStr>>();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue