|
| 1 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 2 | +import js from "@eslint/js"; |
| 3 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 4 | +import typescriptParser from "@typescript-eslint/parser"; |
| 5 | +import prettierConfig from "eslint-config-prettier"; |
| 6 | +import prettierPlugin from "eslint-plugin-prettier"; |
| 7 | +import { dirname } from "path"; |
| 8 | +import { fileURLToPath } from "url"; |
| 9 | + |
| 10 | +const __filename = fileURLToPath(import.meta.url); |
| 11 | +const __dirname = dirname(__filename); |
| 12 | + |
| 13 | +const compat = new FlatCompat({ |
| 14 | + baseDirectory: __dirname, |
| 15 | + recommendedConfig: js.configs.recommended, |
| 16 | +}); |
| 17 | + |
| 18 | +export default [ |
| 19 | + { |
| 20 | + ignores: ["node_modules/**", ".next/**", "out/**", "build/**", "dist/**", "tsconfig.tsbuildinfo"], |
| 21 | + }, |
| 22 | + ...compat.extends("next/core-web-vitals"), |
| 23 | + js.configs.recommended, |
| 24 | + { |
| 25 | + files: ["**/*.{js,jsx,ts,tsx}"], |
| 26 | + languageOptions: { |
| 27 | + parser: typescriptParser, |
| 28 | + parserOptions: { |
| 29 | + ecmaVersion: "latest", |
| 30 | + sourceType: "module", |
| 31 | + ecmaFeatures: { |
| 32 | + jsx: true, |
| 33 | + }, |
| 34 | + }, |
| 35 | + globals: { |
| 36 | + React: "readonly", |
| 37 | + JSX: "readonly", |
| 38 | + NodeJS: "readonly", |
| 39 | + }, |
| 40 | + }, |
| 41 | + plugins: { |
| 42 | + "@typescript-eslint": typescriptEslint, |
| 43 | + prettier: prettierPlugin, |
| 44 | + }, |
| 45 | + rules: { |
| 46 | + ...typescriptEslint.configs.recommended.rules, |
| 47 | + "@typescript-eslint/no-unused-vars": ["error"], |
| 48 | + "@typescript-eslint/no-explicit-any": ["off"], |
| 49 | + "@typescript-eslint/ban-ts-comment": ["off"], |
| 50 | + "@typescript-eslint/triple-slash-reference": "off", |
| 51 | + "@typescript-eslint/no-require-imports": "off", |
| 52 | + "@next/next/no-html-link-for-pages": ["error", "pages/"], |
| 53 | + "no-undef": "off", |
| 54 | + "prettier/prettier": [ |
| 55 | + "warn", |
| 56 | + { |
| 57 | + endOfLine: "auto", |
| 58 | + }, |
| 59 | + ], |
| 60 | + }, |
| 61 | + }, |
| 62 | + { |
| 63 | + files: ["cypress/**/*.ts"], |
| 64 | + languageOptions: { |
| 65 | + globals: { |
| 66 | + cy: "readonly", |
| 67 | + Cypress: "readonly", |
| 68 | + describe: "readonly", |
| 69 | + it: "readonly", |
| 70 | + expect: "readonly", |
| 71 | + beforeEach: "readonly", |
| 72 | + afterEach: "readonly", |
| 73 | + }, |
| 74 | + }, |
| 75 | + }, |
| 76 | + { |
| 77 | + files: ["next.config.mjs", "tailwind.config.js"], |
| 78 | + rules: { |
| 79 | + "@typescript-eslint/no-var-requires": "off", |
| 80 | + "@typescript-eslint/no-require-imports": "off", |
| 81 | + }, |
| 82 | + }, |
| 83 | + prettierConfig, |
| 84 | +]; |
0 commit comments