-
Notifications
You must be signed in to change notification settings - Fork 452
Expand file tree
/
Copy patheslint.config.mjs
More file actions
166 lines (148 loc) · 4.52 KB
/
eslint.config.mjs
File metadata and controls
166 lines (148 loc) · 4.52 KB
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
import { fixupPluginRules } from "@eslint/compat";
import github from "eslint-plugin-github";
import { importX, createNodeResolver } from "eslint-plugin-import-x";
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
import noAsyncForeach from "eslint-plugin-no-async-foreach";
import jsdoc from "eslint-plugin-jsdoc";
import tseslint from "typescript-eslint";
import globals from "globals";
const githubFlatConfigs = github.getFlatConfigs();
export default [
{
ignores: [
"**/webpack.config.js",
"build/**/*",
"lib/**/*",
"src/testdata/**/*",
"tests/**/*",
"build.mjs",
"eslint.config.mjs",
".github/**/*",
],
},
// eslint-plugin-github recommended config (includes eslint:recommended,
// eslint-plugin-import, eslint-comments, i18n-text, and github rules).
githubFlatConfigs.recommended,
// eslint-plugin-github typescript config (includes
// @typescript-eslint/recommended and escompat).
...githubFlatConfigs.typescript,
// Type-checked rules from typescript-eslint (the github plugin only
// includes the base recommended rules, not the type-checked ones).
...tseslint.configs.recommendedTypeCheckedOnly,
// import-x TypeScript settings (parsers, extensions, external-module-folders).
// This is needed for import-x rules to properly parse TypeScript files.
{
settings: importX.flatConfigs.typescript.settings,
},
{
plugins: {
"import-x": importX,
"no-async-foreach": fixupPluginRules(noAsyncForeach),
"jsdoc": jsdoc,
},
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.node,
},
parserOptions: {
project: "./tsconfig.json",
},
},
settings: {
"import/resolver": {
node: {
moduleDirectory: ["node_modules", "src"],
},
typescript: {},
},
"import/ignore": ["sinon", "uuid", "@octokit/plugin-retry", "del", "get-folder-size"],
"import-x/resolver-next": [
createTypeScriptImportResolver(),
createNodeResolver({
extensions: [".ts", ".js", ".json"],
}),
],
},
rules: {
"github/filenames-match-regex": ["error", "^[a-z0-9-]+(\\.test)?$"],
"i18n-text/no-en": "off",
"import/extensions": [
"error",
{
json: {},
},
],
"import/no-amd": "error",
"import/no-commonjs": "error",
// import/no-cycle does not seem to work with ESLint 9.
// Use import-x/no-cycle from eslint-plugin-import-x instead.
"import/no-cycle": "off",
"import-x/no-cycle": "error",
"import/no-dynamic-require": "error",
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: true,
},
],
"import/no-namespace": "off",
"import/no-unresolved": "error",
"import/no-webpack-loader-syntax": "error",
"import/order": [
"error",
{
alphabetize: {
order: "asc",
},
"newlines-between": "always",
},
],
"max-len": [
"error",
{
code: 120,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
"no-async-foreach/no-async-foreach": "error",
"no-sequences": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"one-var": ["error", "never"],
// Check param names to ensure that we don't have outdated JSDocs.
"jsdoc/check-param-names": [
"error",
{
// We don't currently require full JSDoc coverage, so this rule
// should not error on missing @param annotations.
disableMissingParamChecks: true,
}
],
},
},
{
files: ["**/*.ts", "**/*.js"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
}
],
"func-style": "off",
},
},
];