fix: enforce plugins gate for JS/TS config rule resolution#545
Merged
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
2c6bc6e to
f706e46
Compare
In JS/TS flat configs, plugin rules (e.g. `@typescript-eslint/no-explicit-any`) now require their corresponding plugin to be declared in `plugins` before they take effect. This aligns with ESLint's behavior where plugins must be registered before their rules can be used. Core changes: - Add `Plugins` field to `MergedConfig` and merge plugins from matching entries - Add `enforcePlugins` parameter to `GetEnabledRules` (true for JS/TS, false for JSON) - Add `NormalizePluginName` and `RulePluginPrefix` helpers - Add `plugins: ['@typescript-eslint']` to the TS recommended preset - JSON config behavior is unchanged (no plugin enforcement) Test restructuring: - Split Go tests: config_merge_test.go, config_plugin_test.go, loader_normalize_test.go, rule_registry_test.go - Split E2E tests: js-config/ folder with helpers, normalize-config, load-config, cli-integration, plugin-enforcement, presets
f706e46 to
1973746
Compare
hardfist
approved these changes
Mar 19, 2026
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.
Summary
@typescript-eslint/no-explicit-any) now require their corresponding plugin to be declared inpluginsbefore they take effect. This aligns with ESLint's behavior where plugins must be registered before their rules can be used.no-debugger) are always active regardless ofpluginsdeclarations.plugins: ["eslint-plugin-import"]in JSON config failed to injectimport/rules due to missing name normalization.ts.configs.recommended) now includesplugins: ['@typescript-eslint']so existing users are not affected.Key changes:
Plugin registry (
config.go)KnownPluginsregistry as single source of truth for all supported plugins, withRulePrefix,DeclNames(supports multiple aliases), andgetAllRulesNormalizePluginNameis now a lookup-table based function instead of string manipulationGetAllRulesForPlugin(no callers) andgetAllTypeScriptEslintPluginRules(returned all rules, not just TS rules)Plugin enforcement (
rule_registry.go)GetEnabledRulesacceptsenforcePluginsparam (true for JS/TS configs, false for JSON)MergedConfigtracks mergedPluginsset from matching config entriesRulePluginPrefixextracts plugin prefix from rule namesBug fix (
loader.go)normalizeJSONConfignow normalizes plugin names before callingGetPluginRules, fixingplugins: ["eslint-plugin-import"]failing to injectimport/rulesLSP (
service.go)getConfigForURIreturnsisJSConfigbool to thread plugin enforcement correctlyPreset (
typescript.ts)plugins: ['@typescript-eslint']to the TS recommended presetTest restructuring
config_merge_test.go,config_plugin_test.go,loader_normalize_test.go,rule_registry_test.gojs-config/folder:helpers.ts,normalize-config.test.ts,load-config.test.ts,cli-integration.test.ts,plugin-enforcement.test.ts,presets.test.tsRelated Links
Fixes the issue where
plugins: ["@typescript-eslint"]in JS/TS config had no effect — rules would work even without the plugin declaration, causing confusion.Checklist