
- Удален ненужный .eslintignore (файлы уже не существовали) - Настроен ESLint только для нужных папок: src/, prisma/, scripts/ - Добавлены конкретные служебные файлы в ignores вместо паттернов - Более точная и профессиональная настройка линтера 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
73 lines
2.1 KiB
JavaScript
73 lines
2.1 KiB
JavaScript
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"),
|
||
{
|
||
// Применяем правила только к папкам с основным кодом
|
||
files: [
|
||
"src/**/*.{js,jsx,ts,tsx}",
|
||
"prisma/**/*.{js,ts}",
|
||
"scripts/**/*.{js,mjs,ts}"
|
||
],
|
||
ignores: [
|
||
".next/**/*",
|
||
"node_modules/**/*",
|
||
"build/**/*",
|
||
"dist/**/*",
|
||
"*.config.js",
|
||
"*.config.mjs",
|
||
// Игнорируем временные и служебные файлы в корне
|
||
"diagnostic-script.js",
|
||
"dev.log",
|
||
"server.log"
|
||
],
|
||
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; |