-
Notifications
You must be signed in to change notification settings - Fork 136
/
eslint.config.mjs
133 lines (121 loc) · 3.46 KB
/
eslint.config.mjs
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 globals from "globals";
import pluginJs from "@eslint/js";
// eslint-disable-next-line import/no-unresolved
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";
import pluginImport from "eslint-plugin-import";
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
import pluginReactHooks from "eslint-plugin-react-hooks";
export default tseslint.config(
{
ignores: ["analysis/", "build/", "public/upgrade-50/"],
},
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
{
languageOptions: {
globals: {
...globals.browser,
process: false,
},
},
},
{
settings: {
"import/resolver": {
node: {
extensions: [".cjs", ".mjs", ".js", ".json", ".ts", ".tsx"],
},
},
"import/extensions": [".cjs", ".js", ".mjs", ".jsx", ".ts", ".tsx"],
react: {
version: "detect",
},
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
pluginImport.flatConfigs.recommended,
pluginJsxA11y.flatConfigs.recommended,
{
plugins: {
"react-hooks": pluginReactHooks,
},
rules: {
...pluginReactHooks.configs.recommended.rules,
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
// Enable this again when I have totally gotten rid of CJS scripts/configs
"@typescript-eslint/no-require-imports": "off",
// Really just want to disable in TSX files, where this pattern is actually needed https://github.com/typescript-eslint/typescript-eslint/issues/4062
"@typescript-eslint/no-unnecessary-type-constraint": "off",
// Nice for catching if(0){} but too many false positives for object checks that can't be disabled
/*"@typescript-eslint/strict-boolean-expressions": ["error", {
"allowString": true,
"allowNumber": false,
"allowNullableObject": true,
"allowNullableBoolean": true,
"allowNullableString": true,
"allowNullableNumber": false,
"allowAny": true
}],*/
"jsx-a11y/anchor-has-content": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/no-onchange": "off",
"jsx-a11y/no-static-element-interactions": "off",
"eslint-comments/no-unused-disable": "off",
"no-constant-condition": ["error", { checkLoops: false }],
"no-empty": "off",
"no-self-compare": "error",
"prefer-const": [
"error",
{
destructuring: "all",
},
],
radix: ["error", "as-needed"],
"react/display-name": "off",
"react/jsx-key": "off",
"react/no-unescaped-entities": "off",
"react/prop-types": "off",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
},
},
{
files: ["**/*.test.{cjs,js,ts}"],
languageOptions: {
globals: {
...globals.jest,
},
},
},
{
files: ["**/*.js", "tools/**/*.{cjs,js,ts}"],
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
"@typescript-eslint/no-var-requires": "off",
},
},
{
files: ["src/test/*.{js,ts}"],
languageOptions: {
globals: {
...globals.jest,
...globals.mocha,
},
},
},
);