import { dirname } from "path"; import { fileURLToPath } from "url"; import { FlatCompat } from "@eslint/eslintrc"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const compat = new FlatCompat({ baseDirectory: __dirname, }); const eslintConfig = [ ...compat.extends("next/core-web-vitals", "next/typescript"), { ignores: [ ".next/**/*", "node_modules/**/*", "build/**/*", "dist/**/*", "*.config.js", "*.config.mjs" ], rules: { // TypeScript правила "@typescript-eslint/no-explicit-any": "warn", "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }], "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-non-null-assertion": "warn", // React правила "react/prop-types": "off", "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "warn", // Общие правила "no-console": ["warn", { allow: ["warn", "error"] }], "no-debugger": "error", "no-duplicate-imports": "error", "no-unused-expressions": "error", // Стиль кода "comma-dangle": ["error", "always-multiline"], "quotes": ["error", "single", { avoidEscape: true }], "semi": ["error", "never"], "max-len": ["warn", { code: 120, ignoreStrings: true }], // Импорты "import/order": ["error", { "groups": ["builtin", "external", "internal", "parent", "sibling", "index"], "newlines-between": "always", "alphabetize": { "order": "asc", "caseInsensitive": true } }] } } ]; export default eslintConfig;