From 2582a502b73142e5b83e0f370ac291bd37b3648d Mon Sep 17 00:00:00 2001 From: camchenry <1514176+camchenry@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:26:43 +0000 Subject: [PATCH] perf(linter): update `no-extra-non-null-assertion` to use diverging match (#14697) Adding the diverging match here enables the linter codegen to recognize this pattern and do node type analysis. --- crates/oxc_linter/src/generated/rule_runner_impls.rs | 7 ++++++- .../src/rules/typescript/no_extra_non_null_assertion.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/oxc_linter/src/generated/rule_runner_impls.rs b/crates/oxc_linter/src/generated/rule_runner_impls.rs index 0073dc09321ab..8f10c3cae7a35 100644 --- a/crates/oxc_linter/src/generated/rule_runner_impls.rs +++ b/crates/oxc_linter/src/generated/rule_runner_impls.rs @@ -2571,7 +2571,12 @@ impl RuleRunner for crate::rules::typescript::no_explicit_any::NoExplicitAny { } impl RuleRunner for crate::rules::typescript::no_extra_non_null_assertion::NoExtraNonNullAssertion { - const NODE_TYPES: Option<&AstTypesBitset> = None; + const NODE_TYPES: Option<&AstTypesBitset> = Some(&AstTypesBitset::from_types(&[ + AstType::CallExpression, + AstType::ComputedMemberExpression, + AstType::StaticMemberExpression, + AstType::TSNonNullExpression, + ])); const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run; } diff --git a/crates/oxc_linter/src/rules/typescript/no_extra_non_null_assertion.rs b/crates/oxc_linter/src/rules/typescript/no_extra_non_null_assertion.rs index ea9bc23079d35..94914f4eb365f 100644 --- a/crates/oxc_linter/src/rules/typescript/no_extra_non_null_assertion.rs +++ b/crates/oxc_linter/src/rules/typescript/no_extra_non_null_assertion.rs @@ -101,7 +101,7 @@ impl Rule for NoExtraNonNullAssertion { None } } - _ => None, + _ => return, }; if let Some(expr) = expr {