Repository navigation
fix(linter): show JS plugin rules when using --print-config - #26143
Closed
tanmoyopenroot wants to merge 1 commit into
Closed
tanmoyopenroot wants to merge 1 commit into
tanmoyopenroot wants to merge 1 commit into
Conversation
--print-config
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
This was referenced Nov 7, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22117.
Problem
oxlint --print-configpreserved thejsPluginsfield, 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
extendsa 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_filerebuilt the printedrulesobject fromConfigStoreBuilder.rules, which only contains built-in rules. JS plugin rules live inConfigStoreBuilder.external_rules, with their names and options stored inExternalPluginStore, so they were never serialized back into the printed config.Changes
ExternalPluginStoreinto the print-config path.ExternalPluginStore::rule_optionsto recover an external rule's options.external_rulesinto the final printedruleslist (usingresolve_plugin_rule_namesfor names) and sort the combined output by plugin/rule name.extends, and independent vs extending nested configs.Tests
Two layers: unit tests on
resolve_final_config_file, and oxlint CLI fixtures that run--print-configend to end.Unit tests (
oxc_linter){ "foo": 1 }prints as["warn", [{ "foo": 1 }]]; a rule with no options prints as"deny".no-debuggerandcustom/*appear together, sorted by plugin name then rule name.Oxlintrc—--print-configpasses the original root config, which may omit rules resolved fromextends. Those rules still come from the builder.extendsthe parent is not auto-merged; the parent prints its JS plugin rules, the child does not.extendsthe parent prints inherited built-in and JS plugin rules, plus its own overrides.CLI fixtures (
oxlint)print_config_js_plugins— a single config withjsPluginsand both a JS plugin rule with options and one without. Asserts the printed JSON includesjsPluginsand both rules.print_config_nested— a nested package config thatextendsa 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.