From e059d633d1caff71f3d48047411ce694869c34ef Mon Sep 17 00:00:00 2001 From: StanisLove Date: Mon, 1 Dec 2025 23:11:50 +0300 Subject: [PATCH] feat: update linter --- eslint.config.mjs | 95 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 07a246e..8971a95 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -20,7 +20,100 @@ const eslintConfig = [ "**/next-env.d.ts", ], }, + { + files: ["**/*.{ts,tsx,js,jsx}"], + rules: { + // TypeScript rules + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-unused-vars": [ + "error", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_", + }, + ], + "@typescript-eslint/no-unsafe-assignment": "error", + "@typescript-eslint/no-unsafe-member-access": "error", + "@typescript-eslint/no-unsafe-call": "error", + "@typescript-eslint/no-unsafe-return": "error", + "@typescript-eslint/no-unsafe-argument": "error", + "@typescript-eslint/explicit-module-boundary-types": "warn", + "@typescript-eslint/no-floating-promises": "error", + "@typescript-eslint/no-misused-promises": "error", + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/no-unnecessary-type-assertion": "error", + "@typescript-eslint/no-non-null-assertion": "warn", + "@typescript-eslint/prefer-nullish-coalescing": "warn", + "@typescript-eslint/prefer-optional-chain": "warn", + "@typescript-eslint/no-unnecessary-condition": "warn", + "@typescript-eslint/no-redundant-type-constituents": "error", + "@typescript-eslint/ban-ts-comment": [ + "error", + { + "ts-expect-error": "allow-with-description", + "ts-ignore": true, + "ts-nocheck": true, + "ts-check": false, + }, + ], + + // Disable base rule as it conflicts with TypeScript version + "no-unused-vars": "off", + + // React rules + "react/react-in-jsx-scope": "off", // Не нужно в Next.js + "react/prop-types": "off", // Используем TypeScript + "react/display-name": "warn", + "react/no-unescaped-entities": "error", + "react/no-unknown-property": "error", + "react/jsx-key": "error", + "react/jsx-no-duplicate-props": "error", + "react/jsx-no-undef": "error", + "react/jsx-uses-react": "off", // Не нужно в Next.js + "react/jsx-uses-vars": "error", + "react/no-array-index-key": "warn", + "react/no-danger": "warn", + "react/no-deprecated": "error", + "react/no-direct-mutation-state": "error", + "react/no-typos": "error", + "react/self-closing-comp": "warn", + + // React Hooks rules + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn", + + // General JavaScript/TypeScript rules + "no-console": ["warn", { allow: ["warn", "error", "log"] }], + "no-debugger": "error", + "no-alert": "warn", + "no-var": "error", + "prefer-const": "error", + "prefer-arrow-callback": "warn", + "no-duplicate-imports": "error", + "no-unreachable": "error", + "no-unused-expressions": "error", + "no-useless-return": "error", + "no-useless-escape": "error", + "no-constant-condition": "error", + "no-empty": "warn", + "no-extra-semi": "error", + "no-func-assign": "error", + "no-inner-declarations": "error", + "no-irregular-whitespace": "error", + "no-obj-calls": "error", + "no-sparse-arrays": "error", + "no-undef": "off", // TypeScript проверяет это + "no-unexpected-multiline": "error", + "no-unreachable-loop": "error", + "use-isnan": "error", + "valid-typeof": "error", + + // Next.js specific (через next/core-web-vitals уже включены, но можно усилить) + "@next/next/no-html-link-for-pages": "error", + "@next/next/no-img-element": "warn", + }, + }, ]; export default eslintConfig; -