diff --git a/webapp/.eslintrc.cjs b/webapp/.eslintrc.cjs index 8a4e508acb..29270da704 100644 --- a/webapp/.eslintrc.cjs +++ b/webapp/.eslintrc.cjs @@ -12,10 +12,17 @@ module.exports = { "plugin:react/jsx-runtime", "plugin:react-hooks/recommended", "plugin:jsdoc/recommended-typescript", - "plugin:prettier/recommended", + "plugin:prettier/recommended", // Must be the last one + ], + plugins: [ + "license-header", + "react-refresh", + ], + ignorePatterns: [ + "dist", + "license-header.js", + ".eslintrc.cjs", ], - plugins: ["react-refresh"], - ignorePatterns: ["dist", ".eslintrc.cjs"], parser: "@typescript-eslint/parser", parserOptions: { // `ecmaVersion` is automatically sets by `esXXXX` in `env` @@ -48,6 +55,7 @@ module.exports = { "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-param-reassign": [ "error", diff --git a/webapp/.prettierignore b/webapp/.prettierignore new file mode 100644 index 0000000000..f8b474f9c3 --- /dev/null +++ b/webapp/.prettierignore @@ -0,0 +1 @@ +license-header.js diff --git a/webapp/package-lock.json b/webapp/package-lock.json index c326297735..a829e29345 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -100,6 +100,7 @@ "eslint": "8.55.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-jsdoc": "48.2.0", + "eslint-plugin-license-header": "0.6.1", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-react": "7.33.2", "eslint-plugin-react-hooks": "4.6.0", @@ -6754,6 +6755,15 @@ "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" } }, + "node_modules/eslint-plugin-license-header": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-license-header/-/eslint-plugin-license-header-0.6.1.tgz", + "integrity": "sha512-9aIz8q3OaMr1/uQmCGCWySjTs5nEXUJexNegz/8lluNcZbEl82Ag1Vyr1Hu3oIveRW1NbXDPs6nu4zu9mbrmWA==", + "dev": true, + "dependencies": { + "requireindex": "^1.2.0" + } + }, "node_modules/eslint-plugin-prettier": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", @@ -11604,6 +11614,15 @@ "node": ">=0.10" } }, + "node_modules/requireindex": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz", + "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", + "dev": true, + "engines": { + "node": ">=0.10.5" + } + }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", diff --git a/webapp/package.json b/webapp/package.json index 0cac1710ac..7f535f238a 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -106,6 +106,7 @@ "eslint": "8.55.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-jsdoc": "48.2.0", + "eslint-plugin-license-header": "0.6.1", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-react": "7.33.2", "eslint-plugin-react-hooks": "4.6.0", diff --git a/webapp/src/vite-env.d.ts b/webapp/src/vite-env.d.ts deleted file mode 100644 index 53c83e842c..0000000000 --- a/webapp/src/vite-env.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * 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. - */ - -/// diff --git a/webapp/tsconfig.json b/webapp/tsconfig.json index 3a20f675ad..c9e8d32271 100644 --- a/webapp/tsconfig.json +++ b/webapp/tsconfig.json @@ -2,7 +2,11 @@ "compilerOptions": { "target": "es2022", "useDefineForClassFields": true, - "lib": ["ES2022", "DOM", "DOM.Iterable"], + "lib": [ + "ES2022", + "DOM", + "DOM.Iterable", + ], "module": "ESNext", "skipLibCheck": true, @@ -13,7 +17,11 @@ "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", - "types": ["vitest/globals", "vitest/jsdom"], + "types": [ + "vite/client", + "vitest/globals", + "vitest/jsdom", + ], /* Linting */ "strict": true, diff --git a/webapp/tsconfig.node.json b/webapp/tsconfig.node.json index b1b8569880..15b8ba2c14 100644 --- a/webapp/tsconfig.node.json +++ b/webapp/tsconfig.node.json @@ -5,7 +5,10 @@ "module": "ESNext", "moduleResolution": "bundler", "allowSyntheticDefaultImports": true, - "types": ["vitest/globals", "vitest/jsdom"] + "types": [ + "vitest/globals", + "vitest/jsdom", + ] }, "include": ["vite.config.ts"] } diff --git a/webapp/vite.config.ts b/webapp/vite.config.ts index 1dfeadfd8a..8dac6c2f4e 100644 --- a/webapp/vite.config.ts +++ b/webapp/vite.config.ts @@ -1,4 +1,17 @@ -/// +/** + * 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 { defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc";