-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(web): Update dependencies 2024-09-16 #1612
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Because eslint-config-standard still not being compatible with eslint > 9 version. The idea is to use eslint-neostandard instead, see * https://github.com/neostandard/neostandard * standard/eslint-config-standard#410 (comment)
Which comes from the cockpit-starter-kit (see #127) but it is actually not needed since Agama does not use flowtype's annotation. What is more, it isn't a cockpit-starter-kit dependency anymoer, see cockpit-project/starter-kit@ab04f35
Which has implied, * Drop eslint-plugin-import in favor of eslint-plugin-import-x Since the eslint-plugin-import support for ESLint 9 is kind of a blocker for such an update at this moment. See import-js/eslint-plugin-import#2948 * Update eslint-plugin-react-hooks to an RC version For moving this update on without waiting until the support reach the @latest version. See facebook/react#30932 (comment) As commented at import-js/eslint-plugin-import#2948 (comment), > the ESLint plugin ecosystem is getting harder and harder to maintain, > and things get worse during major version upgrades.
Because standard does not support ESLint 9 yet because a governance issue, see standard/standard#1948 (comment)
Forcing the new "load-partial-extension" rule to "always"
Which breaks a rule of hooks and makes ESLint complaint. > web/src/queries/storage.ts 162:19 error React Hook > "useSuspenseQueries" is called conditionally. React Hooks must be called > in the exact same order in every component render. Did you accidentally > call a React Hook after an early return? react-hooks/rules-of-hooks Fixed it by depending on a previous query as explained at https://tanstack.com/query/v5/docs/framework/react/guides/dependent-queries#usequeries-dependent-query
To know more, * expand_more: marella/material-symbols#40 * SiWindow: simple-icons/simple-icons#10019
Related to @typescript-eslint/no-explicit-any complaints fixes at e063e1a
imobachgs
approved these changes
Sep 17, 2024
Merged
imobachgs
added a commit
that referenced
this pull request
Sep 20, 2024
Prepare for releasing Agama 10· * #1263 * #1330 * #1407 * #1408 * #1410 * #1411 * #1412 * #1416 * #1417 * #1419 * #1420 * #1421 * #1422 * #1423 * #1424 * #1425 * #1428 * #1429 * #1430 * #1431 * #1432 * #1433 * #1436 * #1437 * #1438 * #1439 * #1440 * #1441 * #1443 * #1444 * #1445 * #1449 * #1450 * #1451 * #1452 * #1453 * #1454 * #1455 * #1456 * #1457 * #1459 * #1460 * #1462 * #1464 * #1465 * #1466 * #1467 * #1468 * #1469 * #1470 * #1471 * #1472 * #1473 * #1475 * #1476 * #1477 * #1478 * #1479 * #1480 * #1481 * #1482 * #1483 * #1484 * #1485 * #1486 * #1487 * #1488 * #1489 * #1491 * #1492 * #1493 * #1494 * #1496 * #1497 * #1498 * #1499 * #1500 * #1501 * #1502 * #1503 * #1504 * #1505 * #1506 * #1507 * #1508 * #1510 * #1511 * #1512 * #1513 * #1514 * #1515 * #1516 * #1517 * #1518 * #1519 * #1520 * #1522 * #1523 * #1524 * #1525 * #1526 * #1527 * #1528 * #1529 * #1530 * #1531 * #1532 * #1533 * #1534 * #1535 * #1536 * #1537 * #1540 * #1541 * #1543 * #1544 * #1545 * #1546 * #1547 * #1548 * #1549 * #1550 * #1552 * #1553 * #1554 * #1555 * #1556 * #1557 * #1558 * #1559 * #1560 * #1562 * #1563 * #1565 * #1566 * #1567 * #1568 * #1569 * #1570 * #1571 * #1572 * #1573 * #1574 * #1575 * #1576 * #1577 * #1578 * #1579 * #1580 * #1581 * #1583 * #1584 * #1585 * #1586 * #1587 * #1588 * #1589 * #1590 * #1591 * #1592 * #1593 * #1596 * #1597 * #1598 * #1600 * #1602 * #1605 * #1606 * #1607 * #1608 * #1610 * #1611 * #1612 * #1613 * #1614 * #1619 * #1620 * #1621
dgdavid
added a commit
that referenced
this pull request
Sep 24, 2024
## Problem Yesterday we found that production build was failing at OBS because type checking. See #1623. There were some _valid_ complaints because of wrong reference and missing @testing-library/dom dependency overlooked during latest migration to latest dependencies versions #1612 However, the build was failing with a bunch of unexpected errors that were not thrown neither on CI nor in our development environments. ``` [tsl] ERROR in /agama/web/src/components/users/UsersPage.tsx(35,8) TS2741: Property 'children' is missing in type '{}' but required in type '{ [x: string]: any; hasGutter?: boolean; children: any; }'. ``` Unexpected because claimed children were actually there, but as nested JSX nodes instead of _regular_ `prop`. Remember, > When you nest content inside a JSX tag, the parent component will receive that content in a prop called children. > > https://react.dev/learn/passing-props-to-a-component#passing-jsx-as-children This made us suspect about [`@types/react`](https://www.npmjs.com/package/@types/react) where a type definition hinting TypeScript about such an _special_ prop is expected. However, since we have no clue about those React advanced types and were in a hurry, we took the shortcut to temporary disable the type checking in order to get the production build working again. Further investigation shows we were on the right track since the issue only occurs when `@types/react` isn't present. The OBS build is using `--legacy-peer-deps`, which does an slightly different dependencies installation. ```diff diff --git a/web/package-lock.json b/web/package-lock.json index aef5ecc90..45f319bc2 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -5200,15 +5200,6 @@ "@types/node": "*" } }, - "node_modules/@types/prop-types": { - "version": "15.7.12", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", - "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true - }, "node_modules/@types/qs": { "version": "6.9.16", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.16.tgz", @@ -5223,31 +5214,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/react": { - "version": "18.3.5", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.5.tgz", - "integrity": "sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "@types/prop-types": "*", - "csstype": "^3.0.2" - } - }, - "node_modules/@types/react-dom": { - "version": "18.3.0", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz", - "integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "@types/react": "*" - } - }, "node_modules/@types/retry": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", @@ -8461,15 +8427,6 @@ "node": ">=14" } }, - "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true - }, "node_modules/data-urls": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", ``` Now, we were able to reproduce the issue faced at OBS. ## Solution The fix is quite simple and clear: to explicitly add the `@types/react` dev dependency. But this PR adds `@types/react-dom` too, to avoid similar silly build issues. ## Testing To make sure this is the right fix, below tests has been performed against `master` branch after restoring the type checking for production build ([`transpileOnlye: development` at webpack config file](https://github.com/openSUSE/agama/blob/37733ab42b9f438ee7893775fd57b9cf05d392bb/web/webpack.config.js#L176)). * `NODE_ENV=production npm run build` does not fail (because `@types/react` dep is present) * Remove `node_modules` and run an `npm install --legacy-peer-deps`: the `NODE_ENV=production npm run build` fails (because `@types/react` is not present) * Add `@types/react` dev dep explicitly (`npm install -D @types/react`) * Remove `node_modules` and run an `npm install --legacy-peer-deps` again: the `NODE_ENV=production npm run build` ends successfully. ## Open questions * Should CI been updated for using the same `npm install` flags than OBS in an attempt to try catching these issues soon? * A bit unrelated with this: should we try to go ahead without `babel-loader`? It still there after start using TypeScript because > ts-loader works very well in combination with [babel](https://babeljs.io/) and [babel-loader](https://github.com/babel/babel-loader). > > https://github.com/TypeStrong/ts-loader?tab=readme-ov-file#babel But maybe we could re-evaluate if we actually need both or could use `ts-loader` only instead. If so, please be aware of https://github.com/TypeStrong/ts-loader?tab=readme-ov-file#faster-builds and https://github.com/TypeStrong/fork-ts-checker-webpack-plugin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update web dependencies to their latest versions via
npm update
andnpm install package-name@latest
when needed.Show/hide `npm outdated` output before proposed changes
Additional notes
ESLint has been updated to the latest v9. To do so, eslint-config-standard plugins were replaced by neostandard. See b447bc2 and 5433c00
Now, the ESLint configuration lives at eslint.config.mjs. See ESLint migration guide https://eslint.org/docs/latest/use/migrate-to-9.0.0
Linters check now (?) TypeScript files
A lot of linters complaints has been fixed. See commit by commit if interested.
As a result of the migration, two icons were removed. One of them was actually not in use. To know more see a5c43a0
Special mention for 89214a7
As you can see in linked commit, the
useVolumeTemplates
query hook has changed significantly when fixing linters complaints. It was using a hook conditionally, breaking theDo not call Hooks after a conditional return statement.
rule of hooks.Although the change was done following the TanStack Query documentation, it has been manually tested too in order to check that everything works as expected when
useProductParams
returnsundefined
. And, apparently, it works: theAdd filesystem
button became disable, as can be seen in following screenshots.useProductParams() -> { mountPoints: [...], ... }
useProductParams() -> undefined
A quote
Previous update: #1184