Skip to content

[NO-JIRA] Update Constitution Principle V to align with React 19#4508

Open
Vincent Liu (xiaogliu) wants to merge 4 commits into
mainfrom
xiaogliu/constitution-v-update
Open

[NO-JIRA] Update Constitution Principle V to align with React 19#4508
Vincent Liu (xiaogliu) wants to merge 4 commits into
mainfrom
xiaogliu/constitution-v-update

Conversation

@xiaogliu
Copy link
Copy Markdown
Contributor

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-types and function-component defaultProps during migration.

Why

1. React 19 has removed both APIs. Per the React 19 upgrade guide:

In React 19, we're removing the propType checks from the React package, and using them will be silently ignored. […] We're also removing defaultProps from function components in place of ES6 default parameters.

So keeping them during migration is either no-op runtime code (propTypes) or actively broken (defaultProps on 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

  • Principle V: replaced the "maintain both" bullet with explicit migration guidance
  • Rationale: added React 19 upgrade guide link explaining why the change is required
  • Version bumped 1.0.2 → 1.1.0 (MINOR — principle guidance change)
  • Added v1.1.0 changelog entry and updated Last Amended date

Test plan

  • Constitution renders cleanly (markdown lint not run; this file isn't covered by the project linters)
  • No template files reference the old "maintain both" wording (verified with grep)

🤖 Generated with Claude Code

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>
@skyscanner-backpack-bot
Copy link
Copy Markdown

Visit https://backpack.github.io/storybook-prs/4508 to see this build running in a browser.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-types and function-component defaultProps during 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.

Comment thread .specify/memory/constitution.md Outdated
Comment thread .specify/memory/constitution.md Outdated
@xiaogliu Vincent Liu (xiaogliu) added the patch Patch production bug label May 21, 2026
@skyscanner-backpack-bot
Copy link
Copy Markdown

Visit https://backpack.github.io/storybook-prs/4508 to see this build running in a browser.

@xiaogliu Vincent Liu (xiaogliu) removed the patch Patch production bug label May 21, 2026
@skyscanner-backpack-bot
Copy link
Copy Markdown

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>
@skyscanner-backpack-bot
Copy link
Copy Markdown

Visit https://backpack.github.io/storybook-prs/4508 to see this build running in a browser.

Copy link
Copy Markdown
Contributor

@RichardSyq Richard-Shen (RichardSyq) left a comment

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 propTypes checks and no longer applies defaultProps for function components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants