update next and lint

This commit is contained in:
dev.daminik00 2025-10-30 01:29:21 +01:00
parent d9a8d171fb
commit 87e7e4b53c
3 changed files with 83 additions and 78 deletions

View File

@ -16,7 +16,6 @@ const compat = new FlatCompat({
const eslintConfig = [ const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"), ...compat.extends("next/core-web-vitals", "next/typescript"),
{ {
plugins: { plugins: {
import: eslintPluginImport, import: eslintPluginImport,
@ -27,84 +26,92 @@ const eslintConfig = [
}, },
rules: { rules: {
/* неиспользуемые переменные и импорты */ /* неиспользуемые переменные и импорты */
"@typescript-eslint/no-unused-vars": [ "@typescript-eslint/no-unused-vars": [
"warn", "warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, { argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
], ],
"unused-imports/no-unused-imports": "error", "unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [ "unused-imports/no-unused-vars": [
"warn", "warn",
{ {
vars: "all", vars: "all",
varsIgnorePattern: "^_", varsIgnorePattern: "^_",
args: "after-used", args: "after-used",
argsIgnorePattern: "^_", argsIgnorePattern: "^_",
}, },
], ],
/* порядок импортов: стили .module.(s)css внизу */ /* порядок импортов: стили .module.(s)css внизу */
"simple-import-sort/imports": [ "simple-import-sort/imports": [
"error", "error",
{ {
groups: [ groups: [
["^\\u0000"], // side-effects ["^\\u0000"], // side-effects
["^react", "^next", "^@?\\w"], // пакеты ["^react", "^next", "^@?\\w"], // пакеты
["^@/"], // алиасы проекта ["^@/"], // алиасы проекта
["^\\.\\.?(?:/|$)"], // относительные импорты (включая "..") ["^\\.\\.?(?:/|$)"], // относительные импорты (включая "..")
["^.+\\.module\\.(css|scss)$"], // модули стилей ["^.+\\.module\\.(css|scss)$"], // модули стилей
], ],
}, },
], ],
"simple-import-sort/exports": "error", "simple-import-sort/exports": "error",
/* React правила */ /* React правила */
"react/jsx-uses-react": "off", // не нужно в React 17+ "react/jsx-uses-react": "off", // не нужно в React 17+
"react/react-in-jsx-scope": "off", // не нужно в React 17+ "react/react-in-jsx-scope": "off", // не нужно в React 17+
"react/prop-types": "off", // используем TypeScript "react/prop-types": "off", // используем TypeScript
"react/display-name": "warn", "react/display-name": "warn",
"react/jsx-key": "error", "react/jsx-key": "error",
"react/jsx-no-duplicate-props": "error", "react/jsx-no-duplicate-props": "error",
"react/jsx-no-undef": "error", "react/jsx-no-undef": "error",
// "react/no-array-index-key": "warn", // "react/no-array-index-key": "warn",
"react/no-danger": "warn", "react/no-danger": "warn",
"react/no-deprecated": "error", "react/no-deprecated": "error",
"react/no-direct-mutation-state": "error", "react/no-direct-mutation-state": "error",
"react/no-find-dom-node": "error", "react/no-find-dom-node": "error",
"react/no-is-mounted": "error", "react/no-is-mounted": "error",
"react/no-render-return-value": "error", "react/no-render-return-value": "error",
"react/no-string-refs": "error", "react/no-string-refs": "error",
"react/no-unescaped-entities": "warn", "react/no-unescaped-entities": "warn",
"react/no-unknown-property": "error", "react/no-unknown-property": "error",
"react/no-unsafe": "warn", "react/no-unsafe": "warn",
"react/self-closing-comp": "error", "react/self-closing-comp": "error",
/* React Hooks правила */ /* React Hooks правила */
"react-hooks/rules-of-hooks": "error", "react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn", "react-hooks/exhaustive-deps": "warn",
/* TypeScript правила */ /* TypeScript правила */
"@typescript-eslint/no-explicit-any": "warn", "@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-non-null-assertion": "warn", "@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-var-requires": "error", "@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "warn", "@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-inferrable-types": "error",
/* Общие правила */ /* Общие правила */
"no-console": "warn", "no-console": "warn",
"no-debugger": "error", "no-debugger": "error",
"no-alert": "warn", "no-alert": "warn",
"no-var": "error", "no-var": "error",
"prefer-const": "error", "prefer-const": "error",
"no-unused-expressions": "error", "no-unused-expressions": "error",
"no-duplicate-imports": "error", "no-duplicate-imports": "error",
"no-multiple-empty-lines": ["error", { max: 2 }], "no-multiple-empty-lines": ["error", { max: 2 }],
"eol-last": "error", "eol-last": "error",
"no-trailing-spaces": "error", "no-trailing-spaces": "error",
},
}, },
]; }, {
ignores: [
"node_modules/**",
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
"public/metrics-scripts/**"
]
}];
export default eslintConfig; export default eslintConfig;

1
package-lock.json generated
View File

@ -30,7 +30,6 @@
"zustand": "^5.0.5" "zustand": "^5.0.5"
}, },
"devDependencies": { "devDependencies": {
"@eslint/eslintrc": "^3",
"@svgr/webpack": "^8.1.0", "@svgr/webpack": "^8.1.0",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",

View File

@ -6,8 +6,8 @@
"dev": "next dev --turbopack", "dev": "next dev --turbopack",
"build": "next build", "build": "next build",
"start": "next start -p 3001", "start": "next start -p 3001",
"lint": "next lint", "lint": "eslint .",
"lint:fix": "next lint --fix", "lint:fix": "eslint --fix .",
"format": "prettier --write .", "format": "prettier --write .",
"format:check": "prettier --check .", "format:check": "prettier --check .",
"type-check": "tsc --noEmit" "type-check": "tsc --noEmit"
@ -35,7 +35,6 @@
"zustand": "^5.0.5" "zustand": "^5.0.5"
}, },
"devDependencies": { "devDependencies": {
"@eslint/eslintrc": "^3",
"@svgr/webpack": "^8.1.0", "@svgr/webpack": "^8.1.0",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",