Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions crates/oxc_linter/src/generated/rule_runner_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ impl RuleRunner for crate::rules::eslint::max_params::MaxParams {
}

impl RuleRunner for crate::rules::eslint::new_cap::NewCap {
const NODE_TYPES: Option<&AstTypesBitset> = None;
const NODE_TYPES: Option<&AstTypesBitset> =
Some(&AstTypesBitset::from_types(&[AstType::CallExpression, AstType::NewExpression]));
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
}

Expand Down Expand Up @@ -953,7 +954,12 @@ impl RuleRunner for crate::rules::eslint::unicode_bom::UnicodeBom {
}

impl RuleRunner for crate::rules::eslint::use_isnan::UseIsnan {
const NODE_TYPES: Option<&AstTypesBitset> = None;
const NODE_TYPES: Option<&AstTypesBitset> = Some(&AstTypesBitset::from_types(&[
AstType::BinaryExpression,
AstType::CallExpression,
AstType::SwitchCase,
AstType::SwitchStatement,
]));
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
}

Expand Down Expand Up @@ -1269,7 +1275,8 @@ impl RuleRunner for crate::rules::jest::no_test_prefixes::NoTestPrefixes {
}

impl RuleRunner for crate::rules::jest::no_test_return_statement::NoTestReturnStatement {
const NODE_TYPES: Option<&AstTypesBitset> = None;
const NODE_TYPES: Option<&AstTypesBitset> =
Some(&AstTypesBitset::from_types(&[AstType::CallExpression, AstType::Function]));
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
}

Expand Down Expand Up @@ -2071,7 +2078,8 @@ impl RuleRunner for crate::rules::react::exhaustive_deps::ExhaustiveDeps {
}

impl RuleRunner for crate::rules::react::forbid_elements::ForbidElements {
const NODE_TYPES: Option<&AstTypesBitset> = None;
const NODE_TYPES: Option<&AstTypesBitset> =
Some(&AstTypesBitset::from_types(&[AstType::CallExpression, AstType::JSXOpeningElement]));
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
}

Expand Down Expand Up @@ -2171,7 +2179,8 @@ impl RuleRunner for crate::rules::react::jsx_props_no_spread_multi::JsxPropsNoSp
}

impl RuleRunner for crate::rules::react::no_array_index_key::NoArrayIndexKey {
const NODE_TYPES: Option<&AstTypesBitset> = None;
const NODE_TYPES: Option<&AstTypesBitset> =
Some(&AstTypesBitset::from_types(&[AstType::CallExpression, AstType::JSXElement]));
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
}

Expand All @@ -2188,7 +2197,8 @@ impl RuleRunner for crate::rules::react::no_danger::NoDanger {
}

impl RuleRunner for crate::rules::react::no_danger_with_children::NoDangerWithChildren {
const NODE_TYPES: Option<&AstTypesBitset> = None;
const NODE_TYPES: Option<&AstTypesBitset> =
Some(&AstTypesBitset::from_types(&[AstType::CallExpression, AstType::JSXElement]));
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
}

Expand Down
8 changes: 7 additions & 1 deletion tasks/linter_codegen/src/match_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ impl MatchDetector {
}
}
Pat::Wild(_) => {
// Body must be completely empty.
// Body must be completely empty, or return empty type only `()`
if let Expr::Block(block) = &*arm.body {
if block.block.stmts.is_empty() {
CollectionResult::Complete
} else {
CollectionResult::Incomplete
}
} else if let Expr::Tuple(tuple) = &*arm.body {
if tuple.elems.is_empty() {
CollectionResult::Complete
} else {
CollectionResult::Incomplete
}
} else {
CollectionResult::Incomplete
}
Expand Down
Loading