Migrate codebase to React 18#298
Conversation
9f8bd52 to
d55223b
Compare
* Upgrades react and react-dom from ^16.13.0 to ^18.3.0 * Upgrades eslint-config-invenio to ^2.1.0 * Replaces enzyme-adapter-react-16 with @cfaester/enzyme-adapter-react-18 ^0.8.0 * Requires Node version >=22.0.0
d55223b to
9d43498
Compare
* Applies update-react-imports codemod * Applies pure-component codemod * Migrates ReactDOM.render to createRoot API
* Removes unused devDependencies (cheerio, coveralls, expect) * Not used or needed with Node 22+ & React v18 * Fixes npm audit warnings
* Replaces enzyme adapter for React 18 compatibility * Replaces eslint rules to apply React 18 rules
ed3fcdb to
58f618e
Compare
| "overrides": { | ||
| "react-scripts": { | ||
| "svgo": "^3.3.2", | ||
| "resolve-url-loader": "^5.0.0", | ||
| "css-minimizer-webpack-plugin": "^8.0.0" | ||
| }, | ||
| "underscore": "^1.13.8", | ||
| "@tootallnate/once": "^3.0.1", | ||
| "sockjs": "^0.3.24", | ||
| "uuid": "^14.0.0", | ||
| "serialize-javascript": "^7.0.5", | ||
| "workbox-build": "^7.3.0", | ||
| "@svgr/webpack": "^6.5.1", | ||
| "enzyme": { | ||
| "cheerio": "1.0.0-rc.12" | ||
| } |
There was a problem hiding this comment.
Is these overrides needed? Because it's not done in inveniosoftware/react-invenio-forms#334 ?
There was a problem hiding this comment.
These are here there purely to address npm audit vulnerability issues. For react-invenio-forms, it reports basically just something about old tinymce (which i'm tackling with a separate PR)
There was a problem hiding this comment.
I changed from tinymce to hugerte in the python modules
There was a problem hiding this comment.
Unfortunately, I don't think that pywebpack takes overrides into account, so we are using the updated libraries here when using npm, but not when integrating this module in InvenioRDM.
ntarocco
left a comment
There was a problem hiding this comment.
Thanks! I have added a small comment.
| "qs": "^6.8.0", | ||
| "react": "^16.13.0", | ||
| "react-dom": "^16.13.0", | ||
| "react": "^18.3.0", |
There was a problem hiding this comment.
Is the min version v18 required now? Can we keep v16 instead?
There was a problem hiding this comment.
v18 is the new minimum, necessiting a major release - there are breaking changes introduced, mainly the createRoot API to render React apps, explicit React import removal, default props removal, more non-backwards compatible changes may also come in future PRs as we gradually adopt more react 18 features
❤️ Thank you for your contribution!
Description
Migrate react-searchkit from React 16 to React 18 following RFC inveniosoftware/rfcs#112.
Prerequisites
To make React 18 linting work, you need to link a local clone of eslint-config-invenio:
In this repo:
npm auditdown to just 2 moderate severity vulnerabilities (due towebpack-dev-server- didn't manage to solve that one)Requires:
Part of: inveniosoftware/rfcs#112
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Frontend