Skip to content

fix(linter): show JS plugin rules when using --print-config - #26143

Closed
tanmoyopenroot wants to merge 1 commit into
oxc-project:mainfrom
tanmoyopenroot:fix-22117/print-missing-jsplugin-rules
Closed

tanmoyopenroot wants to merge 1 commit into
oxc-project:mainfrom
tanmoyopenroot:fix-22117/print-missing-jsplugin-rules

Conversation

@tanmoyopenroot

Copy link
Copy Markdown

Closes #22117.

Problem

oxlint --print-config preserved the jsPlugins field, but silently dropped rules that came from those JS plugins. Linting still worked because external rules were resolved for the normal lint path; the bug was specific to the printed config output.

This also affected nested configs: a child config that extends a parent with JS plugin rules would print the inherited built-in rules, but not the inherited JS plugin rules.

Root cause

ConfigStoreBuilder::resolve_final_config_file rebuilt the printed rules object from ConfigStoreBuilder.rules, which only contains built-in rules. JS plugin rules live in ConfigStoreBuilder.external_rules, with their names and options stored in ExternalPluginStore, so they were never serialized back into the printed config.

Changes

  • Pass ExternalPluginStore into the print-config path.
  • Add ExternalPluginStore::rule_options to recover an external rule's options.
  • Merge external_rules into the final printed rules list (using resolve_plugin_rule_names for names) and sort the combined output by plugin/rule name.
  • Cover both a flat JS plugin config and a nested config that extends a parent with JS plugin rules.
  • Add unit tests for mixed built-in/external rules, rules inherited via extends, and independent vs extending nested configs.

Tests

Two layers: unit tests on resolve_final_config_file, and oxlint CLI fixtures that run --print-config end to end.

Unit tests (oxc_linter)

  • External rules with and without options — a JS plugin rule with { "foo": 1 } prints as ["warn", [{ "foo": 1 }]]; a rule with no options prints as "deny".
  • Mixed built-in and JS plugin rules — no-debugger and custom/* appear together, sorted by plugin name then rule name.
  • Rules not present on the input Oxlintrc — --print-config passes the original root config, which may omit rules resolved from extends. Those rules still come from the builder.
  • Independent nested configs — a child config that does not extends the parent is not auto-merged; the parent prints its JS plugin rules, the child does not.
  • Nested config that extends the parent — a child that extends the parent prints inherited built-in and JS plugin rules, plus its own overrides.

CLI fixtures (oxlint)

  • print_config_js_plugins — a single config with jsPlugins and both a JS plugin rule with options and one without. Asserts the printed JSON includes jsPlugins and both rules.
  • print_config_nested — a nested package config that extends a parent with JS plugin rules. Asserts the printed config includes inherited JS plugin rules plus the child's own rule.

AI Assistance

This PR was prepared with AI assistance. I reviewed the generated changes and test results, and I am responsible for the contribution.

@camc314 camc314 added the A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details label Sep 2, 2026
@overlookmotel overlookmotel added the L-js-plugins Linter > JS plugins (ESLint-compatible plugin API) label Sep 4, 2026
@overlookmotel overlookmotel changed the title [FIX] [LINTER] Show JSPlugin rules when using "--print-config" fix(linter): show JS plugin rules when using --print-config Sep 4, 2026
@codspeed

codspeed Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 76 skipped benchmarks1


Comparing tanmoyopenroot:fix-22117/print-missing-jsplugin-rules (45a8fd9) with main (c3dedc9)

Open in CodSpeed

Footnotes

  1. 76 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. ↩

@camc314

camc314 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Hi! Thanks for working on this. #29532, #29534 have addressed this issue, so this PR is no longer needed.

Thanks!

@camc314 camc314 closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details L-js-plugins Linter > JS plugins (ESLint-compatible plugin API)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: --print-config silently drops jsPlugins rules from output

3 participants