-
Notifications
You must be signed in to change notification settings - Fork 5
/
eslint.config.mjs
125 lines (104 loc) · 3.61 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
import stylistic from "@stylistic/eslint-plugin";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import promise from "eslint-plugin-promise";
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: ["**/dummy-ext/", "**/test_projects/", "**/esbuild.js"],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:promise/recommended",
), {
plugins: {
"@stylistic": stylistic,
"@typescript-eslint": typescriptEslint,
promise,
},
languageOptions: {
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: ".",
},
},
rules: {
"@stylistic/indent": ["error", "tab"],
"@stylistic/comma-spacing": ["warn", {
before: false,
after: true,
}],
"@stylistic/no-extra-parens": "warn",
"@typescript-eslint/no-restricted-types": ["error", {
types: {
Object: "Use {} instead.",
String: "Use 'string' instead.",
Number: "Use 'number' instead.",
Boolean: "Use 'boolean' instead.",
},
}],
"@typescript-eslint/naming-convention": ["error", {
selector: "interface",
format: ["PascalCase"],
custom: {
regex: "^I[A-Z]",
match: true,
},
}],
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
"@typescript-eslint/no-floating-promises": ["error", {
checkThenables: true,
}],
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-unnecessary-condition": 0,
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
vars: "all",
args: "none",
ignoreRestSiblings: false,
}],
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/switch-exhaustiveness-check": "warn",
"promise/catch-or-return": "warn",
"promise/no-callback-in-promise": "off",
"promise/always-return": ["warn", {
ignoreLastCallback: true,
}],
"no-console": "warn",
"no-empty": "warn",
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
"no-trailing-spaces": ["error", {
skipBlankLines: false,
}],
"prefer-promise-reject-errors": "error",
quotes: ["warn", "single"],
semi: ["error", "never"],
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["warn", "always"],
"space-in-parens": ["warn", "never"],
"spaced-comment": ["error", "always", {
markers: ["/"],
}],
},
}];