Skip to content

Commit 3a908e7

Browse files
committed
feat(linter/eslint-plugin-vitest): Use run on jest node instead of run once
1 parent 4ca559c commit 3a908e7

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

crates/oxc_linter/src/generated/rule_runner_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4017,7 +4017,7 @@ impl RuleRunner for crate::rules::vitest::require_local_test_context_for_concurr
40174017

40184018
impl RuleRunner for crate::rules::vitest::warn_todo::WarnTodo {
40194019
const NODE_TYPES: Option<&AstTypesBitset> = None;
4020-
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::RunOnce;
4020+
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::RunOnJestNode;
40214021
}
40224022

40234023
impl RuleRunner for crate::rules::vue::define_emits_declaration::DefineEmitsDeclaration {

crates/oxc_linter/src/rules/vitest/warn_todo.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use crate::{
77
context::LintContext,
88
rule::Rule,
99
utils::{
10-
JestFnKind, JestGeneralFnKind, PossibleJestNode, collect_possible_jest_call_node,
11-
is_type_of_jest_fn_call, parse_general_jest_fn_call,
10+
JestFnKind, JestGeneralFnKind, PossibleJestNode, is_type_of_jest_fn_call,
11+
parse_general_jest_fn_call,
1212
},
1313
};
1414

@@ -52,13 +52,12 @@ declare_oxc_lint!(
5252
);
5353

5454
impl Rule for WarnTodo {
55-
fn run_once(&self, ctx: &LintContext) {
56-
let mut possibles_jest_nodes = collect_possible_jest_call_node(ctx);
57-
possibles_jest_nodes.sort_unstable_by_key(|n| n.node.id());
58-
59-
for possible_jest_node in &possibles_jest_nodes {
60-
WarnTodo::run(possible_jest_node, ctx);
61-
}
55+
fn run_on_jest_node<'a, 'c>(
56+
&self,
57+
jest_node: &PossibleJestNode<'a, 'c>,
58+
ctx: &'c LintContext<'a>,
59+
) {
60+
WarnTodo::run(jest_node, ctx);
6261
}
6362
}
6463

0 commit comments

Comments
 (0)