chore: remove PropTypes and defaultProps for React 19 compatibility by unrevised6419 · Pull Request #26107 · strapi/strapi · GitHub
Skip to content

chore: remove PropTypes and defaultProps for React 19 compatibility#26107

Open
unrevised6419 wants to merge 4 commits intostrapi:developfrom
unrevised6419:worktree-remove-default-props
Open

chore: remove PropTypes and defaultProps for React 19 compatibility#26107
unrevised6419 wants to merge 4 commits intostrapi:developfrom
unrevised6419:worktree-remove-default-props

Conversation

@unrevised6419
Copy link
Copy Markdown
Contributor

Summary

React 19 silently ignores propTypes and removes defaultProps from function components. This PR finishes the removal across the monorepo so the codebase is free of both deprecations.

  • Convert the 10 remaining PropTypes-using .jsx files in plugins/users-permissions/admin/src to .tsx with TS interfaces and ES6 default parameters.
  • Replace defaultProps on the styled-component LinkWrapperButton in core/upload with .attrs({ type: 'button' }).
  • Drop the now-unused prop-types dependency from core/upload and plugins/users-permissions package.json files.

After this PR:

  • rg "from 'prop-types'" packages/ → 0 matches
  • rg "\.defaultProps\s*=" packages/ → 0 matches
  • rg '"prop-types":' packages/*/package.json → 0 matches

Depends on #26106 — that PR scaffolds the TypeScript migration for plugins/users-permissions (tsconfig, build pipeline, entry rename). The .jsx.tsx conversions in this PR rely on that scaffolding and should merge after it.

Test plan

  • yarn workspace @strapi/plugin-users-permissions run lint — 0 errors
  • yarn workspace @strapi/plugin-users-permissions run build:types:admin — clean
  • yarn workspace @strapi/plugin-users-permissions run test:front — 45/45 pass
  • yarn workspace @strapi/upload run lint — 0 errors
  • yarn workspace @strapi/upload run test:ts:front — clean
  • yarn workspace @strapi/upload run test:front — 468/468 pass
  • Manual smoke test in admin UI: Roles list + edit, Providers, Email Templates, Advanced Settings pages in plugins/users-permissions

🤖 Generated with Claude Code

unrevised6419 and others added 3 commits April 23, 2026 19:07
Align plugin folder structure with all other packages/plugins/* which
use an admin/src + server/src split. The users-permissions server
tree previously lived at the package root under server/ — an outlier.

Precursor to adding TypeScript support, which is in turn required to
drop React propTypes/defaultProps usage in the admin side (both
removed from function components in React 19).

- Move packages/plugins/users-permissions/server/* → server/src/*
- Update package.json exports["./strapi-server"].source
- Update rollup.config.mjs input + rootDir
- Adjust one relative path in server/src/services/__tests__/jwt.test.js
  that reached tests/helpers at repo root (now one level deeper)

No runtime or behavior changes. Jest coverage glob already uses
server/**/*.{js,ts} which continues to match recursively.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Follow-up to the server → server/src rename: update stale path
references in the sessions-and-jwt auth doc and the documentation
plugin README.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add tsconfig, ESLint configs, and rename entry files (index.js -> index.ts)
for both admin and server. Update package.json exports and build pipeline
to emit types. Switch rollup to basePluginConfig helper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

@dosubot dosubot Bot added pr: chore This PR contains chore tasks (cleanups, configs, tooling...) source: plugin:users-permissions Source is plugin/users-permissions package labels Apr 23, 2026
React 19 silently ignores `propTypes` and removes `defaultProps` from
function components. This commit finishes the removal across the
monorepo:

- Convert the 10 remaining PropTypes-using `.jsx` files in
  `plugins/users-permissions/admin/src` to `.tsx` with TS interfaces
  and ES6 default parameters.
- Replace `defaultProps` on styled-component `LinkWrapperButton` in
  `core/upload` with `.attrs({ type: 'button' })`.
- Drop the now-unused `prop-types` dependency from
  `core/upload` and `plugins/users-permissions` package.json files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@unrevised6419 unrevised6419 force-pushed the worktree-remove-default-props branch from 6b3011c to f7c3217 Compare April 23, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: chore This PR contains chore tasks (cleanups, configs, tooling...) source: plugin:users-permissions Source is plugin/users-permissions package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant