Skip to content

chore(react19): automatic JSX runtime, remove deprecated defaultProps#3452

Draft
charlesmulder wants to merge 4 commits intoRedHatInsights:masterfrom
charlesmulder:RHCLOUD-44375
Draft

chore(react19): automatic JSX runtime, remove deprecated defaultProps#3452
charlesmulder wants to merge 4 commits intoRedHatInsights:masterfrom
charlesmulder:RHCLOUD-44375

Conversation

@charlesmulder
Copy link
Copy Markdown
Contributor

@charlesmulder charlesmulder commented Apr 13, 2026

Summary

Preparatory changes for React 19 (RHCLOUD-44375). No functional changes — build config and dead code removal only. Tenant apps remain on React 18.3.

  • Switch JSX transform to automatic runtime (tsconfig.json, SWC loader in webpack.config.js + webpack.cy.config.js)

  • Add react/jsx-runtime as a Module Federation singleton in production config; non-eager singleton in Cypress config (eager causes a share scope initialization deadlock in Cypress's bootstrapless MF environment)

  • Add @rhds/icons resolve alias to Cypress webpack config to fix a module-not-found error from @rhds/elements

  • Remove defaultProps on HeaderAlert and GenerateId — deprecated in React 18.3, removed in React 19; defaults already declared in function destructuring

  • Remove unnecessary React default imports in 5 files — only needed for the old classic JSX transform

    Out of scope (deferred to RHCLOUD-44216)

    onUncaughtError/onCaughtError on createRoot, React 19 codemods (forwardRef migration, ref callback types), and dependency upgrades (react@19, react-intl, @testing-library/react).

Summary by CodeRabbit

  • Refactor

    • Switched to the automatic JSX runtime in build and TypeScript settings; added the JSX runtime to module sharing.
    • Removed redundant default React imports across multiple files.
  • Style

    • Eliminated legacy default prop assignment from the header alert component.
  • Lint

    • Disabled rules that required React to be in scope for JSX.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b8cfa872-f323-4dcd-a905-cded9a14afc8

📥 Commits

Reviewing files that changed from the base of the PR and between cba15ad and d676656.

📒 Files selected for processing (12)
  • config/webpack.config.js
  • config/webpack.cy.config.js
  • config/webpack.plugins.js
  • eslint.config.js
  • src/analytics/useAmplitude.test.tsx
  • src/bootstrap.tsx
  • src/components/Header/HeaderAlert.tsx
  • src/hooks/useQuickstarLinksStore.tsx
  • src/hooks/useTrialRedirect.test.tsx
  • src/inventoryPoc/FilterToolbar.tsx
  • src/utils/loading-fallback.tsx
  • tsconfig.json
💤 Files with no reviewable changes (4)
  • src/inventoryPoc/FilterToolbar.tsx
  • src/analytics/useAmplitude.test.tsx
  • src/utils/loading-fallback.tsx
  • src/components/Header/HeaderAlert.tsx
✅ Files skipped from review due to trivial changes (5)
  • tsconfig.json
  • eslint.config.js
  • src/hooks/useTrialRedirect.test.tsx
  • config/webpack.plugins.js
  • src/hooks/useQuickstarLinksStore.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/webpack.config.js

Walkthrough

Switches the project to React's automatic JSX transform by updating SWC and TypeScript configs, adding react/jsx-runtime to Module Federation shares, removing now-unnecessary default React imports across several files, and removing PatternFly GenerateId bootstrap defaults and a component defaultProps assignment.

Changes

Cohort / File(s) Summary
Build config (SWC & TSX)
config/webpack.config.js, config/webpack.cy.config.js, tsconfig.json
Enable SWC React transform runtime = automatic and set TypeScript jsx compiler option to react-jsx.
Module Federation / Plugins
config/webpack.plugins.js, config/webpack.cy.config.js
Add react/jsx-runtime as a shared singleton (eager) entry alongside existing react/react-dom shared singletons; add resolve alias @rhds/icons in cy config.
Bootstrap / Runtime
src/bootstrap.tsx
Remove default React import and delete PatternFly GenerateId.defaultProps bootstrap configuration.
Component defaults
src/components/Header/HeaderAlert.tsx
Remove HeaderAlert.defaultProps assignment; rely on parameter destructuring defaults.
Import cleanup (tests & utils)
src/analytics/useAmplitude.test.tsx, src/hooks/useQuickstarLinksStore.tsx, src/hooks/useTrialRedirect.test.tsx, src/inventoryPoc/FilterToolbar.tsx, src/utils/loading-fallback.tsx
Remove unused default React imports or adjust imports to named-only where applicable; no logic/test behavior changes.
Linting rules
eslint.config.js
Turn off react/react-in-jsx-scope and react/jsx-uses-react rules in the TypeScript ESLint block.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Tests Required ❌ Error PR modifies 5 source files but lacks corresponding test coverage. Three files have no tests, two have untouched existing tests, and modified test files don't correspond to changed source code. Add or update test files for all modified source code: bootstrap.test.tsx, update HeaderAlert.test.js, add FilterToolbar.test.tsx, and add loading-fallback.test.tsx to meet production requirements.
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: switching to automatic JSX runtime and removing deprecated defaultProps, which directly aligns with the primary objectives of this React 19 preparatory PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Typescript Strict Mode ✅ Passed PR maintains TypeScript strict mode compliance with no new type violations introduced. Only existing code is removed or reorganized.
Auth Abstraction Layer ✅ Passed PR does not violate authentication abstraction layer; no direct imports of OIDC libraries found outside permitted directory in modified files.
Chrome Api Breaking Changes ✅ Passed PR contains only React 19 preparatory changes (config updates, import cleanup, defaultProps removal) with no modifications to src/chrome/create-chrome.ts, confirming the Chrome API remains unmodified.
Module Federation Compatibility ✅ Passed Module Federation configuration properly adds react/jsx-runtime as shared singleton with correct version coordination and maintains all exposed modules and existing dependencies unchanged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
config/webpack.cy.config.js (1)

39-43: Add react/jsx-runtime to Cypress Module Federation shared deps for consistency with production

The automatic JSX runtime enabled at lines 39-43 implicitly requires react/jsx-runtime. The production config (webpack.plugins.js) shares this dependency with version constraint, but the Cypress config omits it. Adding it to the shared list ensures consistency across test and production Module Federation configurations.

Proposed patch
      shared: [
        { react: { singleton: true, eager: true } },
        { 'react-dom': { singleton: true, eager: true } },
+       { 'react/jsx-runtime': { singleton: true, eager: true } },
        { 'react-router-dom': { singleton: true } },
        { '@openshift/dynamic-plugin-sdk': { singleton: true } },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/webpack.cy.config.js` around lines 39 - 43, The Cypress webpack config
enables the automatic JSX runtime (transform.react.runtime = 'automatic') but
the ModuleFederationPlugin shared dependencies list omits 'react/jsx-runtime',
causing inconsistency with production; update the ModuleFederationPlugin shared
configuration to include 'react/jsx-runtime' alongside 'react' and 'react-dom'
(use the same sharing options/version constraint pattern as in
webpack.plugins.js, e.g., singleton/requiredVersion settings) so the Cypress
build shares the same runtime module as production.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@config/webpack.cy.config.js`:
- Around line 39-43: The Cypress webpack config enables the automatic JSX
runtime (transform.react.runtime = 'automatic') but the ModuleFederationPlugin
shared dependencies list omits 'react/jsx-runtime', causing inconsistency with
production; update the ModuleFederationPlugin shared configuration to include
'react/jsx-runtime' alongside 'react' and 'react-dom' (use the same sharing
options/version constraint pattern as in webpack.plugins.js, e.g.,
singleton/requiredVersion settings) so the Cypress build shares the same runtime
module as production.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d1362fee-8847-47bb-8b8c-93c12265270c

📥 Commits

Reviewing files that changed from the base of the PR and between 640a630 and 6a2377f.

📒 Files selected for processing (11)
  • config/webpack.config.js
  • config/webpack.cy.config.js
  • config/webpack.plugins.js
  • src/analytics/useAmplitude.test.tsx
  • src/bootstrap.tsx
  • src/components/Header/HeaderAlert.tsx
  • src/hooks/useQuickstarLinksStore.tsx
  • src/hooks/useTrialRedirect.test.tsx
  • src/inventoryPoc/FilterToolbar.tsx
  • src/utils/loading-fallback.tsx
  • tsconfig.json
💤 Files with no reviewable changes (4)
  • src/analytics/useAmplitude.test.tsx
  • src/utils/loading-fallback.tsx
  • src/components/Header/HeaderAlert.tsx
  • src/inventoryPoc/FilterToolbar.tsx

@charlesmulder charlesmulder force-pushed the RHCLOUD-44375 branch 2 times, most recently from 013509e to cba15ad Compare April 13, 2026 12:19
@charlesmulder charlesmulder marked this pull request as draft April 13, 2026 12:39
@charlesmulder charlesmulder marked this pull request as ready for review April 13, 2026 13:19
@charlesmulder charlesmulder marked this pull request as draft April 14, 2026 12:46
@charlesmulder
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

1 participant