Skip to content

Commit

Permalink
chore(web): Update dependencies 2024-09-16 (#1612)
Browse files Browse the repository at this point in the history
Update web dependencies to their latest versions via `npm update` and
`npm install package-name@latest` when needed.

## Additional notes

* ESLint has been updated to the latest v9. To do so,
_eslint-config-standard_ plugins were replaced by
[_neostandard_](https://github.com/neostandard/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 the `Do not call Hooks after a conditional
return statement.` [rule of
hooks](https://react.dev/reference/rules/rules-of-hooks).

Although the change was done following the [TanStack Query
documentation](https://tanstack.com/query/v5/docs/framework/react/guides/dependent-queries#usequeries-dependent-query),
it has been manually tested too in order to check that everything works
as expected when `useProductParams` returns `undefined`. And,
apparently, it works: the `Add filesystem` button became disable.

## A quote

> the ESLint plugin ecosystem is getting harder and harder to maintain,
> and things get worse during major version upgrades — read in a
[comment at
eslint-pluign-import](import-js/eslint-plugin-import#2948 (comment))

---

Previous update: #1184
  • Loading branch information
dgdavid authored Sep 17, 2024
2 parents c6cb16c + 68a28e2 commit 1ca19ac
Show file tree
Hide file tree
Showing 63 changed files with 5,314 additions and 4,041 deletions.
3 changes: 0 additions & 3 deletions web/.eslintignore

This file was deleted.

82 changes: 0 additions & 82 deletions web/.eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion web/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"no-descending-specificity": null,
"no-duplicate-selectors": null,
"scss/at-extend-no-missing-placeholder": null,
"scss/at-import-partial-extension": null,
"scss/load-partial-extension": "always",
"scss/at-mixin-pattern": null,
"scss/comment-no-empty": null,
"scss/dollar-variable-pattern": null,
Expand Down
98 changes: 98 additions & 0 deletions web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import js from "@eslint/js";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import neostandard from "neostandard";
import tsEslint from "typescript-eslint";
import tsEslintParser from "@typescript-eslint/parser";
import globals from "globals";
import agamaI18nEslintPlugin from "eslint-plugin-agama-i18n";
import i18nextEslintPlugin from "eslint-plugin-i18next";
import tsEslintPlugin from "@typescript-eslint/eslint-plugin";
import reactHooksPlugin from "eslint-plugin-react-hooks";

const neostandardConfig = neostandard({ semi: true, noStyle: true });

export default [
...neostandardConfig,
js.configs.recommended,
...tsEslint.configs.recommended,
eslintPluginPrettierRecommended,
{
languageOptions: {
ecmaVersion: 7,
sourceType: "module",
globals: {
...globals.browser,
...globals.commonjs,
...globals.jest,
...globals.node,
msCrypto: true,
},
parser: tsEslintParser,
},
},
{
plugins: {
"agama-i18n": agamaI18nEslintPlugin,
i18next: i18nextEslintPlugin,
"typescript-eslint": tsEslintPlugin,
"react-hooks": reactHooksPlugin,
},
},
{
rules: {
"agama-i18n/string-literals": "error",
"i18next/no-literal-string": "error",
"no-var": "error",
"no-multi-str": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
ignoreRestSiblings: true,
},
],
"@typescript-eslint/no-unsafe-function-type": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/ban-ts-comment": "off",
"lines-between-class-members": [
"error",
"always",
{
exceptAfterSingleLine: true,
},
],
"prefer-promise-reject-errors": [
"error",
{
allowEmptyReject: true,
},
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
camelcase: "off",
"comma-dangle": "off",
curly: "off",
"jsx-quotes": "off",
"key-spacing": "off",
"no-console": "off",
quotes: "off",
"react/jsx-curly-spacing": "off",
"react/jsx-indent-props": "off",
"react/prop-types": "off",
"space-before-function-paren": "off",
"n/no-callback-literal": "off",
},
},
{
files: ["**/*.test.*", "src/test-utils.js"],
rules: { "i18next/no-literal-string": "off" },
},
{
files: ["src/i18n.test.js"],
rules: { "agama-i18n/string-literals": "off" },
},
{
ignores: ["node_modules/*", "src/lib/*", "src/**/test-data/*"],
},
];
Loading

0 comments on commit 1ca19ac

Please sign in to comment.