Skip to content

refactor: per-rule meta exports + auto-generated registry/README#66

Draft
lainterr[bot] wants to merge 1 commit intomainfrom
refactor/per-rule-meta-eliminate-stomp
Draft

refactor: per-rule meta exports + auto-generated registry/README#66
lainterr[bot] wants to merge 1 commit intomainfrom
refactor/per-rule-meta-eliminate-stomp

Conversation

@lainterr
Copy link
Copy Markdown
Contributor

@lainterr lainterr Bot commented May 4, 2026

Summary

Eliminates the multi-PR stomp pattern from issue #65.

Each rule file now exports its own meta const (name, severity, platforms, category, description). scripts/sync.ts regenerates src/rules/index.ts and 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)

  1. Create src/rules/my-rule.ts exporting a RuleFunction and a meta object.
  2. Create tests/my-rule.test.ts.
  3. Run npm run sync to regenerate src/rules/index.ts and the README tables.
  4. Run npm test.

Test plan

  • vitest non-CLI suites: 384/384 pass on the refactor branch
  • bun run scripts/sync.ts produces no diff vs hand-edited registry/README
  • CI: sync-verify job confirms the sync script has been run
  • CI: existing build / unit-test / lint / readme-rules / knip jobs pass

Closes #65

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eliminate shared-file conflict pattern in rule PRs (auto-generate registry + README from per-rule meta)

0 participants