[NO-JIRA] Update Constitution Principle V to align with React 19#4508
[NO-JIRA] Update Constitution Principle V to align with React 19#4508Vincent Liu (xiaogliu) wants to merge 4 commits into
Conversation
Replace the "maintain both TypeScript types and prop-types during migration" guidance with explicit instruction to remove prop-types and function-component defaultProps in favour of TypeScript types and ES6 destructuring defaults. Why: - React 19 removes propTypes and function-component defaultProps from the React package (https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-proptypes-and-defaultprops), so retaining them is either no-op or actively broken - Recent migrations (BpkProgress #4486, BpkRadio #4475, BpkFormValidation #4473, BpkAutosuggest #4303, BpkPagination #4500) have all dropped both APIs in a single step; the Constitution should reflect that established practice Bump version 1.0.2 -> 1.1.0 (MINOR: principle guidance change). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4508 to see this build running in a browser. |
There was a problem hiding this comment.
Pull request overview
Updates the Backpack Design System Constitution (Principle V) to align TypeScript migration guidance with React 19’s removal of function-component defaultProps support and React’s deprecation of built-in propTypes checking.
Changes:
- Updates Principle V to instruct removing
prop-typesand function-componentdefaultPropsduring TS migrations. - Expands the Principle V rationale with a link to the React 19 upgrade guide.
- Bumps the constitution version to 1.1.0 and updates version history/changelog metadata.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Visit https://backpack.github.io/storybook-prs/4508 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4508 to see this build running in a browser. |
- Drop the "no ES6 equivalent exists" phrasing for class-component defaultProps (class components can use destructuring defaults inside render); clarify that React 19 only stopped applying defaultProps for function components - Soften "React 19 removes propTypes" to "silently ignores propTypes checks" to match the upgrade guide language (the propTypes API is not removed, only the runtime checks are) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4508 to see this build running in a browser. |
Richard-Shen (RichardSyq)
left a comment
There was a problem hiding this comment.
Left two inline suggestions for the constitution/template consistency points.
| - ✅ .specify/templates/plan-template.md - Updated structure and removed package.json reference | ||
| - ✅ .specify/templates/tasks-template.md - Updated with correct task sequence and examples | ||
| Follow-up TODOs: None - all templates aligned and corrected | ||
| - ✅ No template changes required |
There was a problem hiding this comment.
Suggestion: could we update the task template in the same PR?
Principle V now says migrated components should replace prop-types with TypeScript types and use ES6 defaults instead of function-component defaultProps, but .specify/templates/tasks-template.md still generates a task to “Add prop-types for runtime validation” and a Constitution Check for “TypeScript types + prop-types during migration”.
That leaves newly generated tasks contradicting the updated constitution. I think T015 should be reworded to match the new guidance, and this Sync Impact Report should no longer say “No template changes required”.
| - V. TypeScript Migration & Type Safety: replaced "maintain both TypeScript types | ||
| and prop-types during migration" with explicit guidance to remove prop-types | ||
| and function-component defaultProps in favour of TypeScript types and ES6 | ||
| destructuring defaults, aligning with React 19 (which removed both APIs). |
There was a problem hiding this comment.
Small wording suggestion: could we tighten this summary to match the more precise wording in the principle body?
“React 19 (which removed both APIs)” still sounds like both propTypes and defaultProps APIs were removed wholesale. The React 19 upgrade guide is narrower: React now ignores propTypes checks, and defaultProps no longer applies to function components, while class components still support defaultProps.
Maybe:
aligning with React 19, which ignores
propTypeschecks and no longer appliesdefaultPropsfor function components.
Summary
Replace the "maintain both TypeScript types and prop-types during migration" bullet in Constitution Principle V (TypeScript Migration & Type Safety) with explicit guidance to drop
prop-typesand function-componentdefaultPropsduring migration.Why
1. React 19 has removed both APIs. Per the React 19 upgrade guide:
So keeping them during migration is either no-op runtime code (
propTypes) or actively broken (defaultPropson function components).2. Recent migration practice already drops both APIs. Five consecutive TS migration PRs followed this pattern:
The Constitution wording was generating reviewer friction (see #4500 review thread) because policy and practice had drifted apart.
Changes
Last AmendeddateTest plan
🤖 Generated with Claude Code