chore: update eslint to v9 and its dependencies to the latest versions

This commit is contained in:
Daniil Zhuravlev 2025-04-19 03:08:15 +04:00
parent 221831a080
commit 92831a7db2
7 changed files with 1540 additions and 1015 deletions

View File

@ -1,22 +0,0 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"prettier"
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
settings: { react: { version: "18.2" } },
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"react/prop-types": 0,
},
};

39
eslint.config.js Normal file
View File

@ -0,0 +1,39 @@
import js from "@eslint/js";
import { defineConfig, globalIgnores } from "eslint/config";
import react from "eslint-plugin-react";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import prettier from "eslint-config-prettier/flat";
export default defineConfig([
globalIgnores(["dist/"]),
reactHooks.configs["recommended-latest"],
reactRefresh.configs.vite,
{
plugins: { js, react },
files: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
extends: [js.configs.recommended],
rules: {
...react.configs.recommended.rules,
...react.configs["jsx-runtime"].rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"react/prop-types": 0,
},
settings: { react: { version: "18.2" } },
languageOptions: {
parserOptions: { ecmaFeatures: { jsx: true } },
globals: { ...globals.browser, ...globals.es2020 },
},
},
{
files: ["**/context/**/*.jsx", "**/context/**/*.tsx"],
rules: {
"react-refresh/only-export-components": "off",
},
},
prettier,
]);

2476
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -45,13 +45,14 @@
"@types/react": "^18.2.43", "@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17", "@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react": "^4.3.4",
"eslint": "^8.55.0", "eslint": "^9.25.1",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^10.1.2",
"eslint-plugin-react": "^7.33.2", "eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.5", "eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.0.0",
"postcss": "^8.4.32", "postcss": "^8.4.32",
"prettier": "3.2.5", "prettier": "^3.5.3",
"tailwindcss": "^4.0.14", "tailwindcss": "^4.0.14",
"vite": "^6.3.4" "vite": "^6.3.4"
}, },

View File

@ -716,7 +716,7 @@ export default function ControlPanel({
let obj = null; let obj = null;
try { try {
obj = JSON.parse(text); obj = JSON.parse(text);
} catch (error) { } catch {
return; return;
} }
const v = new Validator(); const v = new Validator();

View File

@ -42,7 +42,7 @@ export default function ImportDiagram({
let jsonObject = null; let jsonObject = null;
try { try {
jsonObject = JSON.parse(e.target.result); jsonObject = JSON.parse(e.target.result);
} catch (error) { } catch {
setError({ setError({
type: STATUS.ERROR, type: STATUS.ERROR,
message: "The file contains an error.", message: "The file contains an error.",

View File

@ -26,6 +26,7 @@ import { isRtl } from "../i18n/utils/rtl";
import { useSearchParams } from "react-router-dom"; import { useSearchParams } from "react-router-dom";
import { get } from "../api/gists"; import { get } from "../api/gists";
// eslint-disable-next-line react-refresh/only-export-components
export const IdContext = createContext({ gistId: "", setGistId: () => {} }); export const IdContext = createContext({ gistId: "", setGistId: () => {} });
export default function WorkSpace() { export default function WorkSpace() {