Skip to content

Commit

Permalink
chore(ui): update Node version, ESLint and Prettier (#2294)
Browse files Browse the repository at this point in the history
ANT-2231
  • Loading branch information
skamril committed Jan 21, 2025
1 parent d14454a commit f0f9303
Show file tree
Hide file tree
Showing 409 changed files with 6,817 additions and 9,439 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: 💚 Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0

- name: 💚 Install dependencies
run: npm install
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0
- name: Cache node modules
uses: actions/cache@v4
with:
Expand All @@ -92,7 +92,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
Expand All @@ -112,7 +112,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
Expand All @@ -132,7 +132,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.16.1
node-version: 22.13.0
- name: Restore node modules
uses: actions/cache@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ v2.15.0 (2023-09-30)

### Chore

* **github-actions:** update Node.js version to 18.16.1 [`b9988f6`](https://github.com/AntaresSimulatorTeam/AntaREST/commit/b9988f6dedc5a653de00bf5becc917487ce589e6)
* **github-actions:** update Node.js version to 22.13.0 [`b9988f6`](https://github.com/AntaresSimulatorTeam/AntaREST/commit/b9988f6dedc5a653de00bf5becc917487ce589e6)
* correct handling of base class with no `__annotations__` in `AllOptionalMetaclass` [`d9ed61f`](https://github.com/AntaresSimulatorTeam/AntaREST/commit/d9ed61fdaaa32974431b41e9cce44be09bb92e79)
* correct indentation [`4af01b4`](https://github.com/AntaresSimulatorTeam/AntaREST/commit/4af01b4023cb828093f8fd9b139f76429806c7b8)
* increase line length limit to 120 characters for Black and iSort [`586fb43`](https://github.com/AntaresSimulatorTeam/AntaREST/commit/586fb438607824899c66db66f183451fbe4a88e4)
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/install/0-INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A local build allows using Antares Web as a desktop application.
Requirements:

- python : 3.11.x
- node : 18.16.1
- node : 22.13.0

Then perform the following steps:

Expand Down
89 changes: 0 additions & 89 deletions webapp/.eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion webapp/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16.1
22.13.0
3 changes: 2 additions & 1 deletion webapp/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"endOfLine": "auto"
"endOfLine": "auto",
"printWidth": 100
}
130 changes: 130 additions & 0 deletions webapp/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/**
* Copyright (c) 2024, RTE (https://www.rte-france.com)
*
* See AUTHORS.txt
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*
* This file is part of the Antares project.
*/

import globals from "globals";
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import reactPlugin from "eslint-plugin-react";
import reactHookPlugin from "eslint-plugin-react-hooks";
import jsdocPlugin from "eslint-plugin-jsdoc";
import prettierPluginRecommended from "eslint-plugin-prettier/recommended";
import licenseHeaderPlugin from "eslint-plugin-license-header";
import reactRefreshPlugin from "eslint-plugin-react-refresh";

export default [
// Must be defined here to be applied to all configurations.
// cf. https://github.com/eslint/eslint/discussions/18304
{
ignores: ["dist/*", "license-header.js"],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
{
...reactPlugin.configs.flat.recommended,
settings: {
react: {
version: "detect",
},
},
},
reactPlugin.configs.flat["jsx-runtime"],
jsdocPlugin.configs["flat/recommended-typescript"],
prettierPluginRecommended, // Must be the last one
{
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
globals: {
...globals.browser,
...globals.es2022,
},
},
plugins: {
"license-header": licenseHeaderPlugin,
"react-hooks": reactHookPlugin,
"react-refresh": reactRefreshPlugin,
},
rules: {
...reactHookPlugin.configs.recommended.rules,
"@typescript-eslint/array-type": ["error", { default: "array-simple" }],
"@typescript-eslint/no-restricted-imports": [
"error",
{
paths: [
{
name: "lodash",
message:
'Import method directly `import [METHOD] from "lodash/[METHOD]"` (safest for bundle size).',
allowTypeImports: true,
},
],
patterns: [
{
group: ["react"],
importNamePattern:
"^(React|Function|Ref|Mutable|CSS|Component|Props|Form)|(Event|Handler|Attributes)$",
message:
'Use `React.[TYPE]` (e.g. `React.ReactNode`) instead of importing it directly from "react".',
},
],
},
],
"@typescript-eslint/no-unused-expressions": ["error", { allowTernary: true }],
"@typescript-eslint/no-unused-vars": ["error", { args: "none", ignoreRestSiblings: true }],
camelcase: [
"error",
{
properties: "never", // TODO: remove when server responses are camel case
allow: [
"MRT_", // For material-react-table
],
},
],
curly: "error",
"jsdoc/no-defaults": "off",
"jsdoc/require-jsdoc": "off",
"jsdoc/require-hyphen-before-param-description": "warn",
"jsdoc/tag-lines": ["warn", "any", { startLines: 1 }], // Expected 1 line after block description
"license-header/header": ["error", "license-header.js"],
"no-console": "warn",
"no-duplicate-imports": "error",
"no-param-reassign": [
"error",
{
props: true,
ignorePropertyModificationsForRegex: [
// For immer, 'acc' for
"^draft",
// For `Array.prototype.reduce()`
"acc",
"accumulator",
],
},
],
"no-use-before-define": [
"error",
{
// Function declarations are hoisted, so it’s safe.
functions: false,
},
],
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"react/hook-use-state": "error",
"react/prop-types": "off",
"react/self-closing-comp": "error",
"require-await": "warn", // TODO: switch to "error" when the quantity of warning will be low
},
},
];
Loading

0 comments on commit f0f9303

Please sign in to comment.