refactor: per-rule meta exports + auto-generated registry/README#66
Draft
lainterr[bot] wants to merge 1 commit intomainfrom
Draft
refactor: per-rule meta exports + auto-generated registry/README#66lainterr[bot] wants to merge 1 commit intomainfrom
lainterr[bot] wants to merge 1 commit intomainfrom
Conversation
Eliminates the multi-PR stomp pattern caused by every new rule needing manual edits to README.md, src/rules/index.ts, and src/rules/meta.ts. Each rule file now exports a `meta` const with name, severity, platforms, category, and description. A new `scripts/sync.ts` regenerates the registry and README rule tables from those exports. CI verifies the script has been run (no diff). Adding a rule now touches one file (the rule itself) plus a deterministic auto-generated edit to index.ts and README.md. Conflicts only happen when two simultaneous PRs add rules whose names sort adjacently — and even those resolve mechanically. Closes #65
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
Eliminates the multi-PR stomp pattern from issue #65.
Each rule file now exports its own
metaconst (name, severity, platforms, category, description).scripts/sync.tsregeneratessrc/rules/index.tsand the README rule tables from those exports. CI verifies the sync script has been run (no diff).Why
Every new rule used to require manual edits to four shared files (
README.md,src/rules/index.ts,src/rules/meta.ts,tests/config-modes.test.ts). Two simultaneous rule PRs would always conflict on at least the README and the registry. After this change, adding a rule touches one file (the rule itself) and deterministic auto-generated edits to two files. Simultaneous PRs only conflict if rule names sort adjacently — and those still resolve mechanically.Adding a rule (new workflow)
src/rules/my-rule.tsexporting aRuleFunctionand ametaobject.tests/my-rule.test.ts.npm run syncto regeneratesrc/rules/index.tsand the README tables.npm test.Test plan
vitestnon-CLI suites: 384/384 pass on the refactor branchbun run scripts/sync.tsproduces no diff vs hand-edited registry/READMEsync-verifyjob confirms the sync script has been runCloses #65