Files
672093f177 feat: Add meta.languages support to rules (#20571)
* Initial plan

* Add meta.languages validation to validateRulesConfig

Co-authored-by: nzakas <[email protected]>

* docs: update custom-rules and custom-rule-tutorial for meta.languages

Co-authored-by: nzakas <[email protected]>

* fix: address review feedback on meta.languages validation

Co-authored-by: nzakas <[email protected]>

* refactor: normalize @/ to js/ before calling doesRuleSupportLanguage, removing special cases

Co-authored-by: fasttime <[email protected]>

* refactor: precompute plugin namespace map to replace for-loops in doesRuleSupportLanguage

Co-authored-by: fasttime <[email protected]>

* refactor: simplify buildPluginNamespaceMap to include all plugins with name fallback

Co-authored-by: fasttime <[email protected]>

* refactor: compute pluginNamespaceMap once in validateRulesConfig and pass to doesRuleSupportLanguage

Co-authored-by: fasttime <[email protected]>

* refactor: simplify doesRuleSupportLanguage guard to !Array.isArray(ruleLangs)

Co-authored-by: fasttime <[email protected]>

* refactor: replace pluginNamespaceMap with validPluginNames in doesRuleSupportLanguage

Co-authored-by: fasttime <[email protected]>

* fix: replace undefined with void 0 (no-undefined rule), add direct-match rule to namespace test

Co-authored-by: fasttime <[email protected]>

* fix: only validate meta.languages when rule is enabled, not at Config construction time

Co-authored-by: nzakas <[email protected]>

* fix: simplify doesRuleSupportLanguage guard and add namespace-match doc example

Co-authored-by: fasttime <[email protected]>

* docs: use more familiar names in namespace-match example

Co-authored-by: fasttime <[email protected]>

* fix: convert inline comment to block comment to fix linting error in test

Co-authored-by: fasttime <[email protected]>

* fix: apply prettier formatting to config.js and tests/lib/config/config.js

Co-authored-by: fasttime <[email protected]>

* fix: improve error message for rules that don't support the current language

Co-authored-by: nzakas <[email protected]>
Agent-Logs-Url: https://github.com/eslint/eslint/sessions/fad3a342-bb5e-47f5-99f0-bd79c80f569b

* Update tests/lib/linter/linter.js

Co-authored-by: Milos Djermanovic <[email protected]>

* Update docs/src/extend/custom-rules.md

Co-authored-by: Milos Djermanovic <[email protected]>

* Formatting

* test: add test for rule-unsupported-language message template

Agent-Logs-Url: https://github.com/eslint/eslint/sessions/475e3c79-203c-408a-a5aa-cdc0a525a2f0

Co-authored-by: fasttime <[email protected]>

---------

Co-authored-by: nzakas <[email protected]>
Co-authored-by: fasttime <[email protected]>
Co-authored-by: Nicholas C. Zakas <[email protected]>
Co-authored-by: Milos Djermanovic <[email protected]>

Co-authored-by: Hanzo Dev <[email protected]>
2026-03-26 18:00:18 +01:00
..