Skip to content

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

Merged
danielchen0 merged 2 commits into
mainfrom
refactor/per-rule-meta-eliminate-stomp
May 14, 2026
Merged

refactor: per-rule meta exports + auto-generated registry/README#66
danielchen0 merged 2 commits into
mainfrom
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

lainterr Bot and others added 2 commits May 4, 2026 02:31
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
@danielchen0 danielchen0 marked this pull request as ready for review May 14, 2026 19:17
Copy link
Copy Markdown
Collaborator

@danielchen0 danielchen0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed after refreshing against main. The merge resolution keeps the per-rule metadata generation model, ports the rules added on main to per-rule meta exports, formats generated output from sync.ts so sync and prettier agree, and CI is green.

@danielchen0 danielchen0 merged commit 6a60a02 into main May 14, 2026
8 checks passed
@danielchen0 danielchen0 deleted the refactor/per-rule-meta-eliminate-stomp branch May 14, 2026 19:18
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)

1 participant