Skip to content

STRWEB-157 change react to react-jsx in tsconfig.json - #167

Merged
EthanFreestone merged 3 commits into
mainfrom
build/tsconfig
May 7, 2026
Merged

STRWEB-157 change react to react-jsx in tsconfig.json#167
EthanFreestone merged 3 commits into
mainfrom
build/tsconfig

Conversation

@EthanFreestone

@EthanFreestone EthanFreestone commented Aug 13, 2025

Copy link
Copy Markdown
Contributor

build: Change jsx configuration to react-jsx to avoid unnecessary import React from 'react' at the top of all .tsx files

We should also look into changing moduleResolution, as node appears to be an alias for node10, designed for use with versions of Node <= 10

However changing this ALSO requires a change to the module configuration, and changes there seemed to brick ui-mosaic-settings, so I have left alone for now

See https://stackoverflow.com/questions/71463698/why-we-need-nodenext-typescript-compiler-option-when-we-have-esnext and @ncovercash comments on thread: https://open-libr-foundation.slack.com/archives/CAN13SWBF/p1755094505685999?thread_ts=1755084794.784919&cid=CAN13SWBF

Seems like the current confiig is quite possibly the best for what we're doing right now as far as moduleResolution is concerned

…import React from 'react'` at the top of all `.tsx` files

We should also look into changing moduleResolution, as `node` appears to be an alias for node10, designed for use with versions of Node <= 10

However changing this ALSO requires a change to the `module` configuration, and changes there seemed to brick ui-mosaic-settings, so I have left alone for now
@ncovercash ncovercash changed the title Discussion: Can we change react to react--jsx in tsconfig.json to avoid unnecessary import React from 'react' Discussion: Can we change react to react-jsx in tsconfig.json to avoid unnecessary import React from 'react' Aug 13, 2025
@github-actions

github-actions Bot commented Aug 13, 2025

Copy link
Copy Markdown

Jest Unit Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 50c3e3e. ± Comparison against base commit aa1b4ca.

♻️ This comment has been updated with latest results.

@EthanFreestone

Copy link
Copy Markdown
Contributor Author

@SerhiiNosko This change has been tested in platform-complete without claims, but when claims is present I cannot even build platform-complete snapshot branch with the old configuration. This makes it difficult to understand what impact it will have on your module

@sonarqubecloud

Copy link
Copy Markdown

@zburke zburke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes! Please! Why didn't we merge this a year ago?!?

@EthanFreestone

Copy link
Copy Markdown
Contributor Author

@zburke Because I wasn't able to confirm that it didn't break all configurations of platform complete, IIRC ui-claims was causing some difficulties :(

@sonarqubecloud

Copy link
Copy Markdown

@alb3rtino

Copy link
Copy Markdown
Contributor

@ncovercash @zburke @SerhiiNosko Bumping this - the import React from 'react' requirement is real friction for TypeScript adoption across the platform, and the underlying change (jsx: "react-jsx") is well-understood and low-risk on its own.

ui-claims does currently have its own issues against the current stripes-webpack, but they are independent of this tsconfig change. Once they're resolved, flipping jsx from react to react-jsx will not cause any additional problems there.

Outstanding issues in ui-claims:

  1. Duplicated @types/react. react-intl@7 pulls in @types/react@19 while the project uses @types/react@18, causing FormattedMessage to fail type-checking.
  2. Missing type declarations for @folio/jest-config-stripes/testing-library/*. The subpath re-exports ship only .js, so imports trigger TS7016.
  3. Stale test fixtures. Several tests fail type-checking due to drift from production types: missing required props (isAllSelected, selectedRecordsDict) and implicit any in fixture literals and callbacks. These need fixing in the tests themselves.

None of these are caused by this PR, and none get worse under react-jsx.

We'd love to see this finally get merged.

@zburke zburke changed the title Discussion: Can we change react to react-jsx in tsconfig.json to avoid unnecessary import React from 'react' STRWEB-157 change react to react-jsx in tsconfig.json May 7, 2026
@zburke
zburke marked this pull request as ready for review May 7, 2026 11:33
@zburke
zburke requested a review from a team as a code owner May 7, 2026 11:33
@zburke

zburke commented May 7, 2026

Copy link
Copy Markdown
Member

@EthanFreestone, @alb3rtino, I moved this from "Draft" to "Open" based on your assertion that issues in ui-claims are unrelated. Consider posting on Slack#folio-stripes-updates before/when you merge to raise awareness of the change. If there are unexpected side-effects in other repositories, that will provide a clue to their owners about what changed and (hopefully) speed up troubleshooting. FTR, I am able to build platform-lsp#snapshot, which includes @folio/claims, with this change in place. This is good news of course, but it's also just one datapoint.

As Noah noted in the Slack conversation Ethan points to in the description, the build scripts in stripes-webpack are chock full of anti-patterns that no doubt made sense at the time, but a lot has changed since those scripts were first written circa 2017 and every FOLIO UI dev was deeply familiar with every folio-org UI repository. We welcome advice and assistance on making targeted changes like this one, and on the larger project of improving how builds work at the repository, workspace, and platform levels.

CC: @ncovercash, @SerhiiNosko

@sonarqubecloud

sonarqubecloud Bot commented May 7, 2026

Copy link
Copy Markdown

@EthanFreestone
EthanFreestone merged commit 7a3e84a into main May 7, 2026
16 checks passed
@EthanFreestone
EthanFreestone deleted the build/tsconfig branch May 7, 2026 13:02
@EthanFreestone

Copy link
Copy Markdown
Contributor Author

Thank you all @zburke @ncovercash @alb3rtino , it's been a long track but it's finally in! 😄

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.

5 participants