-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
164 lines (148 loc) · 4.78 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
import eslintComments from "eslint-plugin-eslint-comments";
import _import from "eslint-plugin-import";
import jest from "eslint-plugin-jest";
import babel from "@babel/eslint-plugin";
import {fixupPluginRules} from "@eslint/compat";
import globals from "globals";
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",
"flow-typed/**/*.js",
"**/coverage",
"**/dist",
],
},
...compat.extends("@khanacademy"),
{
plugins: {
"eslint-comments": eslintComments,
import: fixupPluginRules(_import),
jest,
"@babel": babel,
},
languageOptions: {
globals: {
...globals.jest,
...globals.node,
},
},
rules: {
"constructor-super": "error",
curly: "error",
eqeqeq: ["error", "allow-null"],
"generator-star-spacing": "error",
"guard-for-in": "error",
"linebreak-style": ["error", "unix"],
"no-alert": "error",
"no-array-constructor": "error",
"no-console": "error",
"no-debugger": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-extra-bind": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-throw-literal": "error",
"@babel/no-invalid-this": "error",
"no-with": "error",
"no-async-promise-executor": "error",
"no-const-assign": "error",
"no-else-return": [
"error",
{
allowElseIf: false,
},
],
"no-irregular-whitespace": "off",
"no-multi-str": "error",
"no-prototype-builtins": "off",
"no-restricted-syntax": [
"error",
{
selector: "IntersectionTypeAnnotation",
message:
"Use exact object types and the spread operator instead",
},
],
"no-return-await": "error",
"no-this-before-super": "error",
"no-useless-catch": "off",
"no-useless-call": "error",
"no-undef": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unused-expressions": "error",
"no-unused-vars": [
"error",
{
args: "none",
varsIgnorePattern: "^_*$",
},
],
"no-var": "error",
"one-var": ["error", "never"],
"prefer-const": "error",
"prefer-spread": "error",
"require-await": "error",
"require-yield": "error",
"prefer-template": "off",
"arrow-parens": "off",
"prefer-arrow-callback": "off",
"no-case-declarations": "off",
"valid-jsdoc": "off",
"require-jsdoc": "off",
"eslint-comments/no-unlimited-disable": "error",
"eslint-comments/no-unused-disable": "error",
"import/extensions": [
"error",
"never",
{
ignorePackages: true,
},
],
"import/no-cycle": [
"error",
{
ignoreExternal: true,
commonjs: true,
maxDepth: 6,
},
],
"import/named": "error",
"import/default": "error",
"import/namespace": "error",
"import/no-unassigned-import": [
"error",
{
allow: ["@jest/globals", "jest-extended"],
},
],
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-contain": "error",
"jest/prefer-to-have-length": "error",
"jest/valid-title": "error",
"prettier/prettier": [
"error",
{
tabWidth: 4,
trailingComma: "all",
bracketSpacing: false,
},
],
},
},
];