Repository navigation
feat(plugin-js): add no-config-file-tests rule - #92
Merged
nekomeowww merged 2 commits intoSep 28, 2026
Merged
Conversation
Configuration is declarative, so a standalone test that restates it keeps a second copy of values the configuration already states: every intentional configuration change fails the test, and the failing copy reads as evidence that the change is wrong. The rule reviews test files only. Non-test files are skipped before the model call, so a broad `files:` glob does not pay for every source file, and it is registered without changing `recommended`. Prompt suppresses tests for logic the repository owns, tests that run the configured tool over a fixture, and configuration that carries policy the test must prove.
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.
Problem
Configuration keeps growing standalone test suites:
eslint.config.tsgets aneslint.config.test.tsthat imports the config object and asserts the rule list. The test restates what the configuration already declares, so every intentional configuration change fails it — and a failing copy is easy to read as evidence that the configuration change is wrong. This came up in Discord while reviewing exactly such a diff ("eslint 改个 rule 都加上 test case 了").What this adds
js/no-config-file-tests, a model-backed, cacheable rule in@alint-js/plugin-js:*.test.*,*.spec.*,__tests__/) is skipped before the model call, so a broadfiles:glob does not pay for every source filepackage.json) rather than production behaviorRegistered but not added to
recommended: it only applies to test files, and which globs reach them is the user's call. The README documents it with an opt-in snippet.Verification
pnpm -F @alint-js/plugin-js typecheckpnpm -F @alint-js/plugin-js exec vitest run— 13 passed, 3 newpnpm typecheckandpnpm exec eslint --cache .at the repo rootReview notes
js/no-config-file-tests. Happy to rename.alint.config.tsignores**/*.test.ts, so the rule cannot fire here until test files are part of the run. I left that config alone on purpose — it decides how much of the repo alint sees.tests/ortest/directories without a*.test.*suffix are not treated as test files, so fixture trees stay out of scope.Requested in Discord; drafted by the Discord assistant, so please treat it as a proposal rather than a finished decision.