-
Notifications
You must be signed in to change notification settings - Fork 19
/
eslint.config.mjs
158 lines (151 loc) · 4.73 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// @ts-check
import eslint from "@eslint/js";
import * as depend from "eslint-plugin-depend";
import eslintPluginImportX from "eslint-plugin-import-x";
import vitest from "@vitest/eslint-plugin";
import pluginPromise from "eslint-plugin-promise";
import * as regexpPlugin from "eslint-plugin-regexp";
import pluginSecurity from "eslint-plugin-security";
import globals from "globals";
import tseslint from "typescript-eslint";
// import storybook from "eslint-plugin-storybook";
// Good reference: https://github.com/dustinspecker/awesome-eslint#readme
export default tseslint.config(
eslint.configs.all,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
// ...storybook.configs["flat/recommended"],
eslintPluginImportX.flatConfigs.recommended,
eslintPluginImportX.flatConfigs.typescript,
pluginSecurity.configs.recommended,
regexpPlugin.configs["flat/all"],
pluginPromise.configs["flat/recommended"],
depend.configs["flat/recommended"],
{
ignores: [
".github",
".vscode",
"**/node_modules/",
".git",
"test",
"dist",
".storybook/public",
"storybook-static",
],
name: "Ignore files",
},
{
files: ["**/*.{js,mjs,cjs,ts,tsx}"],
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
ecmaVersion: 2022,
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
linterOptions: {
reportUnusedDisableDirectives: "error",
},
name: "All",
// TODO Consider removing some of these OFF-rules over time
rules: {
"@typescript-eslint/no-dynamic-delete": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off",
// See https://github.com/orgs/react-hook-form/discussions/8622#discussioncomment-4060570
"@typescript-eslint/no-misused-promises": [
2,
{
checksVoidReturn: {
attributes: false,
},
},
],
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
// Prepend "_" in the names of unused function arguments to silence
// Our linter for some useful parameters we want to still display
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
ignoreRestSiblings: true,
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/restrict-template-expressions": "off",
camelcase: "off",
"capitalized-comments": "off",
complexity: "off",
"consistent-return": "off",
"default-param-last": "off",
"func-names": "off",
"func-style": "off",
"id-length": "off",
"import-x/no-named-as-default-member": "off",
"init-declarations": "off",
"max-depth": "off",
"max-lines": "off",
"max-lines-per-function": "off",
"max-params": "off",
"max-statements": "off",
"new-cap": "off",
"no-console": "off",
"no-debugger": "warn",
"no-duplicate-imports": "off",
"no-inline-comments": "off",
"no-lonely-if": "off",
"no-magic-numbers": "off",
"no-multi-assign": "off",
"no-negated-condition": "off",
"no-nested-ternary": "off",
"no-plusplus": "off",
"no-shadow": "off",
"no-ternary": "off",
"no-undefined": "off",
"no-use-before-define": "off",
"no-void": "off",
"no-new": "off",
"no-warning-comments": "off",
"one-var": "off",
"prefer-arrow-callback": "off",
"prefer-destructuring": "off",
"prefer-named-capture-group": "off",
"promise/always-return": "off",
"promise/no-callback-in-promise": "off",
"promise/no-promise-in-callback": "off",
"regexp/no-super-linear-move": "off",
"regexp/prefer-named-capture-group": "off",
"regexp/require-unicode-sets-regexp": "off",
"regexp/no-super-linear-backtracking": "off",
"security/detect-non-literal-fs-filename": "off",
"security/detect-object-injection": "off",
"security/detect-unsafe-regex": "off",
"sort-imports": "off",
"sort-keys": "off",
},
},
{
files: ["__tests__/**"],
plugins: {
vitest,
},
name: "Vitest",
...vitest.configs.recommended.rules,
},
);