File size: 3,693 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import { fixupConfigRules } from "@eslint/compat"
import { FlatCompat } from "@eslint/eslintrc"
import js from "@eslint/js"
import typescriptEslint from "@typescript-eslint/eslint-plugin"
import * as tsParser from "@typescript-eslint/parser"
import testingLibrary from "eslint-plugin-testing-library"
import { defineConfig, globalIgnores } from "eslint/config"
import globals from "globals"
import path from "node:path"
import { fileURLToPath } from "node:url"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
  baseDirectory: __dirname,
  recommendedConfig: js.configs.recommended,
  allConfig: js.configs.all,
})

export default defineConfig([
  globalIgnores([
    "**/dist",
    "**/node_modules",
    "**/coverage",
    "**/.next",
    "**/build",
  ]),
  {
    extends: fixupConfigRules(
      compat.extends(
        "plugin:import/recommended",
        "plugin:import/typescript",
        "plugin:react/recommended",
        "plugin:react-hooks/recommended",
        // "airbnb-typescript",
        "prettier",
      ),
    ),

    plugins: {
      "@typescript-eslint": typescriptEslint,
      "testing-library": testingLibrary,
    },

    languageOptions: {
      globals: {
        ...globals.browser,
        ...globals.node,
      },

      parser: tsParser,
      ecmaVersion: 10,
      sourceType: "module",

      parserOptions: {
        project: "./tsconfig.build.json",
      },
    },

    settings: {
      react: {
        version: "detect",
      },
      "import/resolver": {
        typescript: {
          alwaysTryTypes: true,
          project: "./tsconfig.build.json",
        },
        node: {
          extensions: [".js", ".jsx", ".ts", ".tsx"],
        },
      },
    },

    rules: {
      "@typescript-eslint/ban-ts-comment": "off",
      "@typescript-eslint/no-use-before-define": "off",
      "no-param-reassign": "off",
      "no-console": "off",
      "jsx-a11y/no-autofocus": "off",
      "react/forbid-prop-types": "off",
      "import/prefer-default-export": "off",
      "import/export": "off",
      "import/namespace": "off",
      "no-underscore-dangle": "off",
      "no-shadow": "off",
      "no-plusplus": "off",
      "spaced-comment": "off",
      "guard-for-in": "off",
      "react/no-danger": "off",
      "react/button-has-type": "off",
      "react/no-unescaped-entities": "off",
      "react/react-in-jsx-scope": "off",
      "operator-assignment": "off",
      "prefer-destructuring": "off",
      "react/no-children-prop": "off",
      "consistent-return": "off",
      "react/state-in-constructor": "off",
      "no-restricted-syntax": "off",
      "no-continue": "off",
      eqeqeq: "off",
      "react/destructuring-assignment": "off",
      "@typescript-eslint/dot-notation": "off",
      "no-bitwise": "off",
      "no-redeclare": "off",
      "@typescript-eslint/naming-convention": "off",
      "import/no-extraneous-dependencies": "off",
      "@typescript-eslint/lines-between-class-members": "off",
      "no-alert": "off",
      "import/no-unresolved": "off",

      "react/jsx-filename-extension": [
        "error",
        {
          extensions: [".js", ".tsx"],
        },
      ],

      "react/jsx-props-no-spreading": "off",
      "react/no-array-index-key": "off",
      "react/require-default-props": "off",
      "react/sort-prop-types": "error",
      "react/prop-types": "off",
      "@typescript-eslint/no-shadow": "off",
      "react-hooks/exhaustive-deps": "error",
      "import/no-named-as-default": "off",
      "prefer-object-spread": "off",
      "arrow-body-style": "off",
      "react/sort-comp": "off",
    },
  },
])