|
| 1 | +import { fixupConfigRules } from "@eslint/compat"; |
| 2 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 3 | +import js from "@eslint/js"; |
| 4 | +import typescriptParser from "@typescript-eslint/parser"; |
| 5 | +import { dirname } from "path"; |
| 6 | +import { fileURLToPath } from "url"; |
| 7 | + |
| 8 | +const __filename = fileURLToPath(import.meta.url); |
| 9 | +const __dirname = dirname(__filename); |
| 10 | + |
| 11 | +const compat = new FlatCompat({ |
| 12 | + baseDirectory: __dirname, |
| 13 | + recommendedConfig: js.configs.recommended, |
| 14 | +}); |
| 15 | + |
| 16 | +export default [ |
| 17 | + ...fixupConfigRules( |
| 18 | + compat.extends( |
| 19 | + "next/core-web-vitals", |
| 20 | + "plugin:@typescript-eslint/recommended-type-checked", |
| 21 | + "plugin:@typescript-eslint/stylistic-type-checked" |
| 22 | + ) |
| 23 | + ), |
| 24 | + { |
| 25 | + files: ["**/*.{js,jsx,ts,tsx}"], |
| 26 | + languageOptions: { |
| 27 | + parser: typescriptParser, |
| 28 | + parserOptions: { |
| 29 | + project: true, |
| 30 | + }, |
| 31 | + }, |
| 32 | + rules: { |
| 33 | + "@typescript-eslint/array-type": "off", |
| 34 | + "@typescript-eslint/consistent-type-definitions": "off", |
| 35 | + "@typescript-eslint/consistent-type-imports": [ |
| 36 | + "warn", |
| 37 | + { |
| 38 | + prefer: "type-imports", |
| 39 | + fixStyle: "inline-type-imports", |
| 40 | + }, |
| 41 | + ], |
| 42 | + "@typescript-eslint/no-unused-vars": [ |
| 43 | + "warn", |
| 44 | + { |
| 45 | + argsIgnorePattern: "^_", |
| 46 | + }, |
| 47 | + ], |
| 48 | + "@typescript-eslint/require-await": "off", |
| 49 | + "@typescript-eslint/no-misused-promises": [ |
| 50 | + "error", |
| 51 | + { |
| 52 | + checksVoidReturn: { |
| 53 | + attributes: false, |
| 54 | + }, |
| 55 | + }, |
| 56 | + ], |
| 57 | + "@typescript-eslint/no-floating-promises": "warn", |
| 58 | + "@typescript-eslint/prefer-for-of": "warn", |
| 59 | + "@typescript-eslint/non-nullable-type-assertion-style": "warn", |
| 60 | + "react/no-unescaped-entities": "warn", |
| 61 | + "@typescript-eslint/no-empty-object-type": "warn", |
| 62 | + "@typescript-eslint/prefer-nullish-coalescing": "warn", |
| 63 | + "@typescript-eslint/no-inferrable-types": "warn", |
| 64 | + "@typescript-eslint/consistent-indexed-object-style": "warn", |
| 65 | + "@typescript-eslint/prefer-optional-chain": "warn", |
| 66 | + "@typescript-eslint/no-unsafe-assignment": "warn", |
| 67 | + "@typescript-eslint/no-unsafe-member-access": "warn", |
| 68 | + "@typescript-eslint/no-unsafe-argument": "warn", |
| 69 | + "@typescript-eslint/no-explicit-any": "warn", |
| 70 | + "@typescript-eslint/no-unsafe-call": "warn", |
| 71 | + "no-var": "warn", |
| 72 | + "@typescript-eslint/no-unsafe-return": "warn", |
| 73 | + "@typescript-eslint/prefer-includes": "warn", |
| 74 | + "@typescript-eslint/ban-ts-comment": "warn", |
| 75 | + "@typescript-eslint/no-unnecessary-type-assertion": "warn", |
| 76 | + "@typescript-eslint/restrict-template-expressions": "warn", |
| 77 | + }, |
| 78 | + }, |
| 79 | +]; |
| 80 | + |
0 commit comments