Skip to content

fix(linter): print total rule # when using a single nested config#17517

Merged
graphite-app[bot] merged 1 commit intomainfrom
fix-rule-count-printing
Dec 31, 2025
Merged

fix(linter): print total rule # when using a single nested config#17517
graphite-app[bot] merged 1 commit intomainfrom
fix-rule-count-printing

Conversation

@connorshea
Copy link
Member

@connorshea connorshea commented Dec 31, 2025

For a while, we've been skipping the printing of rule runs unless --disable-nested-config was passed. This was a result of the nested_configs value including the base config (see #16356). When we were checking whether that value was empty, it would always have at least 1 item (unless nested configs were entirely disabled).

As part of this, I've updated some configs in the fixtures to disable correctness rules, otherwise we will end up with a bunch of fixture snapshots needing updates every time a new default rule is added.

It's probably easiest to review this one commit at a time.

Copilot AI review requested due to automatic review settings December 31, 2025 00:50
@connorshea connorshea requested a review from camc314 as a code owner December 31, 2025 00:50
@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-bug Category - Bug labels Dec 31, 2025
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 a bug where the number of rules was not being printed at the end of lint runs. The issue occurred because the nested_configs collection always includes the base config, so checking if it was empty would always fail. The fix changes the check from is_empty() to len() > 1 to account for the base config being present.

  • Changed the condition in number_of_rules() from checking if nested_configs is empty to checking if its length is greater than 1
  • Updated tests to reflect the new behavior, explicitly adding base config to nested_configs to match actual runtime behavior
  • Modified fixture configurations to disable the correctness category to prevent snapshot updates when new default rules are added

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/oxc_linter/src/config/config_store.rs Fixed the number_of_rules() method to check len() > 1 instead of is_empty() and updated the test to match the actual behavior where base config is included in nested_configs
apps/oxlint/src/snapshots/fixtures_issue_10054@oxlint.snap Updated snapshot to show "with 90 rules" in the output
apps/oxlint/src/snapshots/fixtures__tsgolint_rule_options_--type-aware@oxlint.snap Updated snapshot to show "with 6 rules" in the output
apps/oxlint/src/snapshots/fixtures__tsgolint_--type-aware@oxlint.snap Updated snapshot to show "with 44 rules" in the output
apps/oxlint/src/snapshots/fixtures__extends_config_overrides@oxlint.snap Updated snapshot to show "with 90 rules" in the output
apps/oxlint/src/snapshots/fixtures__cross_module_nested_config_@oxlint.snap Updated snapshot to show "with 90 rules" in the output
apps/oxlint/src/snapshots/fixtures__cross_module_extended_config_@oxlint.snap Updated snapshot to show "with 1 rules" in the output
apps/oxlint/src/snapshots/fixtures__auto_config_detection_debugger.js@oxlint.snap Updated snapshot to show "with 1 rules" in the output
apps/oxlint/fixtures/output_formatter_diagnostic/.oxlintrc.json Added "correctness": "off" to categories to prevent future snapshot churn
apps/oxlint/fixtures/import/.oxlintrc.json Added "correctness": "off" to categories to prevent future snapshot churn
apps/oxlint/fixtures/import/.oxlintrc-import-x.json Added "correctness": "off" to categories to prevent future snapshot churn
apps/oxlint/fixtures/ignore_patterns_whitelist/.oxlintrc.json Added "correctness": "off" to categories to prevent future snapshot churn
apps/oxlint/fixtures/ignore_patterns_relative/.oxlintrc.json Added "correctness": "off" to categories and a no-debugger rule to prevent future snapshot churn
apps/oxlint/fixtures/ignore_file_current_dir/.oxlintrc.json Added "correctness": "off" to categories to prevent future snapshot churn
apps/oxlint/fixtures/cross_module_extended_config/config/.oxlintrc.json Added "correctness": "off" to categories to prevent future snapshot churn
apps/oxlint/fixtures/auto_config_detection/.oxlintrc.json Added "correctness": "off" to categories to prevent future snapshot churn

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 31, 2025

CodSpeed Performance Report

Merging #17517 will not alter performance

Comparing fix-rule-count-printing (9f2883e) with main (44b0361)1

Summary

✅ 4 untouched
⏩ 41 skipped2

Footnotes

  1. No successful run was found on main (5b1b02d) during the generation of this report, so 44b0361 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 41 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camc314 camc314 changed the title fix(linter): Fix printing the # of rules at the end of a lint run fix(linter): print total rule # when using a single nested config Dec 31, 2025
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 31, 2025
Copy link
Contributor

camc314 commented Dec 31, 2025

Merge activity

…7517)

For a while, we've been skipping the printing of rule runs unless `--disable-nested-config` was passed. This was a result of the nested_configs value including the base config (see #16356). When we were checking whether that value was empty, it would always have at least 1 item (unless nested configs were entirely disabled).

As part of this, I've updated some configs in the fixtures to disable correctness rules, otherwise we will end up with a bunch of fixture snapshots needing updates every time a new default rule is added.

It's probably easiest to review this one commit at a time.
@graphite-app graphite-app bot force-pushed the fix-rule-count-printing branch from 9f2883e to 96ef2cc Compare December 31, 2025 22:56
@graphite-app graphite-app bot merged commit 96ef2cc into main Dec 31, 2025
20 checks passed
@graphite-app graphite-app bot deleted the fix-rule-count-printing branch December 31, 2025 23:02
graphite-app bot pushed a commit that referenced this pull request Dec 31, 2025
#17520)

This ensures that we print the expected number of rules for users that are using JS Plugins.

Fix #17519.

Based on #17517, because otherwise we'd end up with weird snapshot differences when trying to merge these anyway.

AI Disclosure: The fix here was generated with Copilot + GitHub's Raptor mini model.
graphite-app bot pushed a commit that referenced this pull request Jan 5, 2026
# Oxlint
### 💥 BREAKING CHANGES

- f7da875 oxlint: [**BREAKING**] Remove oxc_language_server binary (#17457) (Boshen)

### 🚀 Features

- 659c23e linter: Init note field boilerplate  (#17589) (Shrey Sudhir)
- 6870b64 parser: Add TS1363 error code (#17609) (Sysix)
- 6154c8c linter/eslint-plugin-vitest: Implemented vitest/warn-todo rule (#17228) (Said Atrahouch)
- 0043cd6 linter/eslint-plugin-vitest: Implement consistent-vitest-vi rule (#17389) (Said Atrahouch)
- a6d773d linter: Add full TS support to eslint/no-useless-constructor (#17592) (camc314)
- f02c0e7 linter/eslint: Implement complexity (#17569) (Nguyen Tran)
- bc7aae7 linter/no-unused-vars: Add fixer to remove unused catch bindings (#17567) (Don Isaac)
- 9e8ec78 linter/only-throw-error rule: Add `allowRethrowing` option for  (#17554) (camc314)
- b67e819 linter: Add fixer for `unicorn/prefer-response-static-json` rule (#17559) (Mikhail Baev)
- 44b0361 linter/vue: Implement no-this-in-before-route-enter (#17525) (yefan)
- ee34716 linter/react: Implement no-will-update-set-state (#17530) (Kenzo Wada)
- 3088e1d linter/react: Implement no-this-in-sfc (#17535) (Kenzo Wada)
- 29a2868 linter/jsx-a11y: Implement no-static-element-interactions (#17538) (Kenzo Wada)
- eadf057 linter: Enable tsconfig auto discovery by default (#17489) (Boshen)
- 12a7d6e website_linter: Add a count of rules with fixes available to rules table. (#17476) (Connor Shea)

### 🐛 Bug Fixes

- a702f13 oxlint/lsp: Correct position for "disable for this file" with shebang (#17613) (Sysix)
- 19fdfb6 linter: Panic in `sort-keys` rule with Unicode numeric characters (#17629) (Adel Rodríguez)
- 2e8f469 vscode: Search for `node_modules/.bin/oxlint.exe` too (bun setup) (#17597) (Sysix)
- be39906 linter/aria-proptypes: Allow template literals with expressions for string-type ARIA props (#17460) (Jökull Sólberg Auðunsson)
- 529901c linter: Include JS plugin rules when calculating total rule count (#17520) (connorshea)
- 96ef2cc linter: Print total rule # when using a single nested config (#17517) (connorshea)
- 9ad0f29 oxlint: Do not enable external plugin store when no external linter is passed (#17498) (Sysix)
- 174375d oxfmt,oxlint: Disable mimalloc for 32-bit Arm targets (#17473) (Yaksh Bariya)
- ff70fe9 linter/no-standalone-expect: Allows expect in wrapper functions passed to test blocks (#17427) (Copilot)
- dab232f linter/catch-or-return: Handle arrow functions with implicit returns correctly (#17440) (Copilot)
- a38892a linter: Update no-unnecessary-template-expression docs and test case (#17453) (camc314)

### ⚡ Performance

- 605dbf1 vscode: Restrict searching for oxlint/oxfmt binaries only 3 levels deep + 10s timeout (#17345) (Sysix)

### 📚 Documentation

- 884fb63 linter/react: Improve docs for jsx-curly-brace-presence (#17579) (connorshea)
- 1d3ee07 linter: Improve rule explanation for `vue/no-this-in-before-route-enter`. (#17581) (connorshea)
- 5f189f8 linter/arrow-body-style: Correctly document default mode option (#17566) (Rägnar O'ock)
- bb2e8e4 linter: Add a note to the `typescript/no-var-requires` rule about the missing `allow` option (#17551) (connorshea)
- 655afc1 linter: Improve docs for `import/extensions` and add a few more tests (#17539) (connorshea)
- 7e5fc90 linter: Update list of plugins that are reserved. (#17516) (connorshea)
# Oxfmt
### 💥 BREAKING CHANGES

- f7da875 oxlint: [**BREAKING**] Remove oxc_language_server binary (#17457) (Boshen)

### 🚀 Features

- 8fd4ea9 oxfmt: `options.embeddedLanguageFormatting` is now `"auto"` by default (#17649) (leaysgur)

### 🐛 Bug Fixes

- c9b5d7d formatter/sort_imports: Handle alignable_comment correctly (#17646) (leaysgur)
- 453222d formatter: Missing comment handling for end-of-line comments in member chains (#17659) (Dunqing)
- 0805ff2 formatter: Incorrect inline comment placement in try-catch (#17657) (Dunqing)
- 3a0c782 formatter: Don't move comments into optional call parentheses (#17582) (magic-akari)
- 174375d oxfmt,oxlint: Disable mimalloc for 32-bit Arm targets (#17473) (Yaksh Bariya)

### ⚡ Performance

- abb28dc oxfmt: Turn of pretty print from sort-package-json (#17452) (Boshen)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants