Skip to content

Commit 5493278

Browse files
committed
perf(linter): no-dupe-class-members: only run when there are any classes (#14867)
Similar to #14865. Allows removing this rule from the array of rules if there are no classes in the file. Benchmarks don't really show any difference here, but it might just be because we haven't yet crossed an allocation threshold (i.e., once we remove enough rules, we'll see a diff)
1 parent ef53462 commit 5493278

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/oxc_linter/src/rules/eslint/no_dupe_class_members.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ impl Rule for NoDupeClassMembers {
8080
}
8181
});
8282
}
83+
84+
fn should_run(&self, ctx: &crate::context::ContextHost) -> bool {
85+
ctx.semantic().classes().len() > 0
86+
}
8387
}
8488

8589
#[test]

0 commit comments

Comments
 (0)