-
Notifications
You must be signed in to change notification settings - Fork 346
/
eslint.config.mjs
187 lines (164 loc) · 5.58 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import jsdoc from "eslint-plugin-jsdoc";
import header from "@tony.ganchev/eslint-plugin-header";
import prettier from "eslint-plugin-prettier";
import reactHooks from "eslint-plugin-react-hooks";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import { fixupPluginRules } from "@eslint/compat";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
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 [
{
ignores: ["**/node_modules", "**/dist", "**/i18n", "**/typings_manual", "**/.github"],
},
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"),
{
plugins: {
jsdoc,
header,
prettier,
"react-hooks": fixupPluginRules(reactHooks),
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
globals: {
...globals.browser,
},
parser: tsParser,
ecmaVersion: 5,
sourceType: "module",
parserOptions: {
project: "tsconfig.json",
},
},
rules: {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/triple-slash-reference": "off",
"no-misleading-character-class": "off",
"no-prototype-builtins": "off",
"no-self-assign": "off",
"no-useless-escape": "off",
"prefer-spread": "off",
"react-hooks/exhaustive-deps": "off",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-inferrable-types": [
"error",
{
ignoreParameters: true,
ignoreProperties: true,
},
],
"@typescript-eslint/no-unused-vars": [
"error",
{
varsIgnorePattern: "^_[a-zA-Z_]",
argsIgnorePattern: "^_[a-zA-Z_]",
},
],
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/semi": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"computed-property-spacing": ["error", "never"],
curly: "error",
"eol-last": "error",
eqeqeq: ["error", "smart"],
"id-denylist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined",
],
"id-match": "error",
"jsdoc/check-alignment": "error",
"jsdoc/require-asterisk-prefix": "error",
"linebreak-style": ["error", "unix"],
"no-caller": "error",
"no-cond-assign": "error",
"no-debugger": "error",
"no-eval": "error",
"no-fallthrough": [
"error",
{
commentPattern: "break[\\s\\w]*omitted",
},
],
"@typescript-eslint/no-invalid-this": "error",
"no-multiple-empty-lines": [
"error",
{
max: 3,
},
],
"no-new-wrappers": "error",
"no-tabs": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-unsafe-finally": "error",
"no-unused-labels": "error",
"no-var": "error",
"one-var": ["error", "never"],
"prefer-arrow-callback": [
"error",
{
allowNamedFunctions: true,
},
],
"prettier/prettier": "error",
"use-isnan": "error",
"header/header": [
"error",
"block",
[
{
pattern: "[Cc]opyright ([(][Cc][)])?\\s*[Oo]nline-[gG]o.com",
},
],
],
"react-hooks/rules-of-hooks": "error",
"prefer-const": [
"error",
{
destructuring: "all",
},
],
},
},
{
files: ["**/*.test.ts", "**/*.test.tsx"],
languageOptions: {
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: null,
},
},
rules: {
"@typescript-eslint/no-floating-promises": "off",
},
},
];