From 5493278d70da201237583d09455d101d8155b642 Mon Sep 17 00:00:00 2001 From: camchenry <1514176+camchenry@users.noreply.github.com> Date: Wed, 22 Oct 2025 08:19:26 +0000 Subject: [PATCH] perf(linter): `no-dupe-class-members`: only run when there are any classes (#14867) Similar to https://github.com/oxc-project/oxc/pull/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) --- crates/oxc_linter/src/rules/eslint/no_dupe_class_members.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/oxc_linter/src/rules/eslint/no_dupe_class_members.rs b/crates/oxc_linter/src/rules/eslint/no_dupe_class_members.rs index 3d3de22e9b569..d475f21ab8861 100644 --- a/crates/oxc_linter/src/rules/eslint/no_dupe_class_members.rs +++ b/crates/oxc_linter/src/rules/eslint/no_dupe_class_members.rs @@ -80,6 +80,10 @@ impl Rule for NoDupeClassMembers { } }); } + + fn should_run(&self, ctx: &crate::context::ContextHost) -> bool { + ctx.semantic().classes().len() > 0 + } } #[test]