From 87e7e4b53c192cac1a5f9705070817ea0ae2a93e Mon Sep 17 00:00:00 2001 From: "dev.daminik00" Date: Thu, 30 Oct 2025 01:29:21 +0100 Subject: [PATCH] update next and lint --- eslint.config.mjs | 155 ++++++++++++++++++++++++---------------------- package-lock.json | 1 - package.json | 5 +- 3 files changed, 83 insertions(+), 78 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index c053932..7cabd1e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -16,7 +16,6 @@ const compat = new FlatCompat({ const eslintConfig = [ ...compat.extends("next/core-web-vitals", "next/typescript"), - { plugins: { import: eslintPluginImport, @@ -27,84 +26,92 @@ const eslintConfig = [ }, rules: { - /* неиспользуемые переменные и импорты */ - "@typescript-eslint/no-unused-vars": [ - "warn", - { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, - ], - "unused-imports/no-unused-imports": "error", - "unused-imports/no-unused-vars": [ - "warn", - { - vars: "all", - varsIgnorePattern: "^_", - args: "after-used", - argsIgnorePattern: "^_", - }, - ], + /* неиспользуемые переменные и импорты */ + "@typescript-eslint/no-unused-vars": [ + "warn", + { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, + ], + "unused-imports/no-unused-imports": "error", + "unused-imports/no-unused-vars": [ + "warn", + { + vars: "all", + varsIgnorePattern: "^_", + args: "after-used", + argsIgnorePattern: "^_", + }, + ], - /* порядок импортов: стили .module.(s)css внизу */ - "simple-import-sort/imports": [ - "error", - { - groups: [ - ["^\\u0000"], // side-effects - ["^react", "^next", "^@?\\w"], // пакеты - ["^@/"], // алиасы проекта - ["^\\.\\.?(?:/|$)"], // относительные импорты (включая "..") - ["^.+\\.module\\.(css|scss)$"], // модули стилей - ], - }, - ], - "simple-import-sort/exports": "error", + /* порядок импортов: стили .module.(s)css внизу */ + "simple-import-sort/imports": [ + "error", + { + groups: [ + ["^\\u0000"], // side-effects + ["^react", "^next", "^@?\\w"], // пакеты + ["^@/"], // алиасы проекта + ["^\\.\\.?(?:/|$)"], // относительные импорты (включая "..") + ["^.+\\.module\\.(css|scss)$"], // модули стилей + ], + }, + ], + "simple-import-sort/exports": "error", - /* React правила */ - "react/jsx-uses-react": "off", // не нужно в React 17+ - "react/react-in-jsx-scope": "off", // не нужно в React 17+ - "react/prop-types": "off", // используем TypeScript - "react/display-name": "warn", - "react/jsx-key": "error", - "react/jsx-no-duplicate-props": "error", - "react/jsx-no-undef": "error", - // "react/no-array-index-key": "warn", - "react/no-danger": "warn", - "react/no-deprecated": "error", - "react/no-direct-mutation-state": "error", - "react/no-find-dom-node": "error", - "react/no-is-mounted": "error", - "react/no-render-return-value": "error", - "react/no-string-refs": "error", - "react/no-unescaped-entities": "warn", - "react/no-unknown-property": "error", - "react/no-unsafe": "warn", - "react/self-closing-comp": "error", + /* React правила */ + "react/jsx-uses-react": "off", // не нужно в React 17+ + "react/react-in-jsx-scope": "off", // не нужно в React 17+ + "react/prop-types": "off", // используем TypeScript + "react/display-name": "warn", + "react/jsx-key": "error", + "react/jsx-no-duplicate-props": "error", + "react/jsx-no-undef": "error", + // "react/no-array-index-key": "warn", + "react/no-danger": "warn", + "react/no-deprecated": "error", + "react/no-direct-mutation-state": "error", + "react/no-find-dom-node": "error", + "react/no-is-mounted": "error", + "react/no-render-return-value": "error", + "react/no-string-refs": "error", + "react/no-unescaped-entities": "warn", + "react/no-unknown-property": "error", + "react/no-unsafe": "warn", + "react/self-closing-comp": "error", - /* React Hooks правила */ - "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "warn", + /* React Hooks правила */ + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn", - /* TypeScript правила */ - "@typescript-eslint/no-explicit-any": "warn", - "@typescript-eslint/no-non-null-assertion": "warn", - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/no-empty-function": "warn", - "@typescript-eslint/no-inferrable-types": "error", + /* TypeScript правила */ + "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/no-non-null-assertion": "warn", + "@typescript-eslint/no-var-requires": "error", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-empty-function": "warn", + "@typescript-eslint/no-inferrable-types": "error", - /* Общие правила */ - "no-console": "warn", - "no-debugger": "error", - "no-alert": "warn", - "no-var": "error", - "prefer-const": "error", - "no-unused-expressions": "error", - "no-duplicate-imports": "error", - "no-multiple-empty-lines": ["error", { max: 2 }], - "eol-last": "error", - "no-trailing-spaces": "error", - }, + /* Общие правила */ + "no-console": "warn", + "no-debugger": "error", + "no-alert": "warn", + "no-var": "error", + "prefer-const": "error", + "no-unused-expressions": "error", + "no-duplicate-imports": "error", + "no-multiple-empty-lines": ["error", { max: 2 }], + "eol-last": "error", + "no-trailing-spaces": "error", }, -]; +}, { + ignores: [ + "node_modules/**", + ".next/**", + "out/**", + "build/**", + "next-env.d.ts", + "public/metrics-scripts/**" + ] +}]; export default eslintConfig; diff --git a/package-lock.json b/package-lock.json index 69169da..217be75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,6 @@ "zustand": "^5.0.5" }, "devDependencies": { - "@eslint/eslintrc": "^3", "@svgr/webpack": "^8.1.0", "@types/node": "^20", "@types/react": "^19", diff --git a/package.json b/package.json index 584ceec..428cdf2 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "dev": "next dev --turbopack", "build": "next build", "start": "next start -p 3001", - "lint": "next lint", - "lint:fix": "next lint --fix", + "lint": "eslint .", + "lint:fix": "eslint --fix .", "format": "prettier --write .", "format:check": "prettier --check .", "type-check": "tsc --noEmit" @@ -35,7 +35,6 @@ "zustand": "^5.0.5" }, "devDependencies": { - "@eslint/eslintrc": "^3", "@svgr/webpack": "^8.1.0", "@types/node": "^20", "@types/react": "^19",