Add mergeProps ESLint migration tooling - #8278
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
Adds internal migration tooling to track component roots that should adopt mergeProps, by introducing a local ESLint rule/package and a scheduled GitHub Actions job that generates a migration-status report.
Changes:
- Introduces a private
@primer/eslint-configpackage that registers theprimer/prefer-merge-propsrule (disabled by default) plus unit tests. - Adds a
script/merge-props-migration-status.mtsreport generator that runs ESLint overpackages/react/srcwith the rule enabled and prints a Markdown summary. - Integrates the report into the scheduled “Migration Status” workflow and registers the local config in the root
eslint.config.mjs.
Show a summary per file
| File | Description |
|---|---|
| script/merge-props-migration-status.mts | Generates a Markdown report by running ESLint with primer/prefer-merge-props enabled and summarizing violations. |
| packages/eslint-config/vitest.config.ts | Configures Vitest for the new ESLint-config workspace package. |
| packages/eslint-config/tsconfig.json | TS config for the new workspace package (including rule/test sources). |
| packages/eslint-config/src/rules/preferMergeProps.ts | Implements the prefer-merge-props ESLint rule logic. |
| packages/eslint-config/src/rules/preferMergeProps.test.ts | Adds RuleTester-based coverage for intended rule boundaries and false-positive avoidance. |
| packages/eslint-config/src/index.ts | Exports the flat config + plugin under the primer namespace and keeps the rule off by default. |
| packages/eslint-config/src/index.test.ts | Verifies package exports and default disabled behavior. |
| packages/eslint-config/package.json | Declares the new private workspace package, deps, and basic scripts. |
| package-lock.json | Links the new workspace package into the lockfile. |
| eslint.config.mjs | Registers the local Primer ESLint config in the root flat config array. |
| .github/workflows/migration-status.yml | Adds a scheduled job to run the mergeProps migration-status script and publish to step summary. |
Review details
Tip
Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 10/11 changed files
- Comments generated: 4
- Review effort level: Lite
| const affectedResults = results.filter(result => { | ||
| return result.messages.some(message => message.ruleId === ruleId) | ||
| }) |
| messages: { | ||
| preferMergeProps: | ||
| 'Spread props on a component root element with mergeProps so component and consumer props are merged intentionally.', | ||
| }, |
| - name: install dependencies | ||
| run: npm ci | ||
| - name: run migration script | ||
| run: node script/merge-props-migration-status.mts >> $GITHUB_STEP_SUMMARY |
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 | ||
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 |
24e1307 to
7169487
Compare
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Ignore pure prop-forwarding wrappers so the adoption report only tracks component roots with props that need intentional merging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 00bfd295-6ed9-4119-8d63-103a0b3c63e8
7169487 to
5e983dc
Compare
Closes #
This PR adds the tooling used to identify and track component roots that should adopt
mergeProps. It introduces a private ESLint package, the migration report script, and the workflow that keeps the report current.Changelog
New
@primer/eslint-configwith theprimer/prefer-merge-propsrule.Changed
Removed
Rollout strategy
This is internal migration tooling and has no public-facing impact.
Testing & Reviewing
Please review the rule boundary and report output. Pure prop-forwarding wrappers should be ignored, while component roots that combine authored and consumer props should remain findings.