Skip to content

fix(linter): do not count type-aware rules, when not enabled#13062

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-13-fix_linter_do_not_count_type-aware_rules_when_not_enabled
Aug 14, 2025
Merged

fix(linter): do not count type-aware rules, when not enabled#13062
graphite-app[bot] merged 1 commit intomainfrom
08-13-fix_linter_do_not_count_type-aware_rules_when_not_enabled

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Aug 13, 2025

closes #13037

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-bug Category - Bug labels Aug 13, 2025
Copy link
Member Author

Sysix commented Aug 13, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Sysix Sysix force-pushed the 08-13-fix_linter_do_not_count_type-aware_rules_when_not_enabled branch from 04b0e44 to 08ba39e Compare August 13, 2025 17:02
@codspeed-hq
Copy link

codspeed-hq bot commented Aug 13, 2025

CodSpeed Instrumentation Performance Report

Merging #13062 will not alter performance

Comparing 08-13-fix_linter_do_not_count_type-aware_rules_when_not_enabled (43b1c5a) with main (920e06f)

Summary

✅ 34 untouched benchmarks

@Sysix Sysix marked this pull request as ready for review August 13, 2025 17:04
Copilot AI review requested due to automatic review settings August 13, 2025 17:04
@Sysix Sysix requested a review from camc314 as a code owner August 13, 2025 17:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where type-aware rules (tsgolint rules) were incorrectly counted in the total rule count when type-aware functionality was disabled. The fix ensures only relevant rules are counted based on the type-aware configuration state.

Key changes:

  • Modified number_of_rules method to accept a type_aware boolean parameter
  • Added filtering logic to exclude tsgolint rules when type-aware is disabled
  • Updated all callers to pass the appropriate type-aware state

Reviewed Changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_linter/src/lib.rs Updated number_of_rules method signature to accept type-aware parameter
crates/oxc_linter/src/config/config_store.rs Implemented filtering logic to exclude tsgolint rules when type-aware is disabled
apps/oxlint/src/lint.rs Updated caller to pass type-aware configuration state
Various snapshot files Updated expected rule counts reflecting the exclusion of type-aware rules

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have an integration/e2e test for this

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Aug 14, 2025
Copy link
Contributor

camc314 commented Aug 14, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 08-13-fix_linter_do_not_count_type-aware_rules_when_not_enabled branch from 08ba39e to df22559 Compare August 14, 2025 15:51
@graphite-app graphite-app bot force-pushed the 08-13-fix_linter_do_not_count_type-aware_rules_when_not_enabled branch from df22559 to 4b5495f Compare August 14, 2025 15:55
@graphite-app graphite-app bot force-pushed the 08-13-fix_linter_do_not_count_type-aware_rules_when_not_enabled branch from 4b5495f to 43b1c5a Compare August 14, 2025 15:57
@graphite-app graphite-app bot merged commit 43b1c5a into main Aug 14, 2025
26 checks passed
@graphite-app graphite-app bot deleted the 08-13-fix_linter_do_not_count_type-aware_rules_when_not_enabled branch August 14, 2025 16:03
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 14, 2025
@Sysix
Copy link
Member Author

Sysix commented Aug 14, 2025

do we have an integration/e2e test for this

@camc314 is this not enough?

fn test_number_of_rules() {
let base_config = LintConfig {
plugins: LintPlugins::new(BuiltinLintPlugins::empty(), FxHashSet::default()),
env: OxlintEnv::default(),
settings: OxlintSettings::default(),
globals: OxlintGlobals::default(),
path: None,
};
let base_rules = vec![
(RuleEnum::EslintCurly(EslintCurly::default()), AllowWarnDeny::Deny),
(
RuleEnum::TypescriptNoMisusedPromises(TypescriptNoMisusedPromises),
AllowWarnDeny::Deny,
),
];
let store = ConfigStore::new(
Config::new(
base_rules.clone(),
vec![],
OxlintCategories::default(),
base_config.clone(),
ResolvedOxlintOverrides::new(vec![]),
),
FxHashMap::default(),
ExternalPluginStore::default(),
);
let mut nested_configs = FxHashMap::default();
nested_configs.insert(
PathBuf::new(),
Config::new(
vec![],
vec![],
OxlintCategories::default(),
base_config.clone(),
ResolvedOxlintOverrides::new(vec![]),
),
);
let store_with_nested_configs = ConfigStore::new(
Config::new(
base_rules,
vec![],
OxlintCategories::default(),
base_config,
ResolvedOxlintOverrides::new(vec![]),
),
nested_configs,
ExternalPluginStore::default(),
);
assert_eq!(store.number_of_rules(false), Some(1));
assert_eq!(store.number_of_rules(true), Some(2));
assert_eq!(store_with_nested_configs.number_of_rules(false), None);
assert_eq!(store_with_nested_configs.number_of_rules(true), None);
}

@camc314
Copy link
Contributor

camc314 commented Aug 14, 2025

sounds good, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: --type-aware rules are counted without enabling them

3 participants