|
| 1 | +import { defineConfig } from "eslint/config" |
| 2 | +import typescriptEslint from "@typescript-eslint/eslint-plugin" |
| 3 | +import tsParser from "@typescript-eslint/parser" |
| 4 | +import path from "node:path" |
| 5 | +import { fileURLToPath } from "node:url" |
| 6 | +import js from "@eslint/js" |
| 7 | +import { FlatCompat } from "@eslint/eslintrc" |
| 8 | + |
| 9 | +const __filename = fileURLToPath(import.meta.url) |
| 10 | +const __dirname = path.dirname(__filename) |
| 11 | +const compat = new FlatCompat({ |
| 12 | + baseDirectory: __dirname, |
| 13 | + recommendedConfig: js.configs.recommended, |
| 14 | + allConfig: js.configs.all |
| 15 | +}) |
| 16 | + |
| 17 | +export default defineConfig([ |
| 18 | + { |
| 19 | + ignores: ["next-env.d.ts", ".next"], |
| 20 | + }, |
| 21 | + { |
| 22 | + extends: [ |
| 23 | + ...compat.extends("next/core-web-vitals"), |
| 24 | + ...compat.extends("eslint:recommended"), |
| 25 | + ...compat.extends("plugin:@typescript-eslint/recommended") |
| 26 | + ], |
| 27 | + |
| 28 | + plugins: { |
| 29 | + "@typescript-eslint": typescriptEslint, |
| 30 | + }, |
| 31 | + |
| 32 | + languageOptions: { |
| 33 | + parser: tsParser, |
| 34 | + }, |
| 35 | + |
| 36 | + rules: { |
| 37 | + "array-callback-return": ["error"], |
| 38 | + "no-await-in-loop": ["error"], |
| 39 | + "no-constant-binary-expression": ["error"], |
| 40 | + "no-constructor-return": ["error"], |
| 41 | + "no-duplicate-imports": ["error"], |
| 42 | + "no-new-native-nonconstructor": ["error"], |
| 43 | + "no-self-compare": ["error"], |
| 44 | + "no-template-curly-in-string": ["error"], |
| 45 | + "no-unmodified-loop-condition": ["error"], |
| 46 | + "no-unreachable-loop": ["error"], |
| 47 | + "no-unused-private-class-members": ["error"], |
| 48 | + "require-atomic-updates": ["error"], |
| 49 | + |
| 50 | + "@typescript-eslint/no-unused-vars": ["error", { |
| 51 | + argsIgnorePattern: "^_", |
| 52 | + }], |
| 53 | + }, |
| 54 | + } |
| 55 | +]) |
0 commit comments