-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.cjs
102 lines (99 loc) · 2.63 KB
/
eslint.config.cjs
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
const eslint = require("@eslint/js");
const tsEslint = require("typescript-eslint");
const prettier = require("eslint-config-prettier");
const importPlugin = require("eslint-plugin-import");
const { fixupPluginRules } = require("@eslint/compat");
module.exports = tsEslint.config(
{
ignores: [
"**/eslint.config.cjs",
"**/package.json",
"**/tsconfig.json",
"**/tsconfig.tsbuildinfo",
],
},
eslint.configs.recommended,
...tsEslint.configs.recommendedTypeChecked,
prettier,
{
plugins: {
// https://github.com/import-js/eslint-plugin-import/issues/2556
import: fixupPluginRules(importPlugin),
},
languageOptions: {
parser: tsEslint.parser,
parserOptions: {
project: true,
},
ecmaVersion: 5,
sourceType: "script",
},
rules: {
// @typescript-eslint
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
ignoreRestSiblings: true,
},
],
"@typescript-eslint/no-explicit-any": [
"error",
{
fixToUnknown: true,
},
],
"@typescript-eslint/no-misused-promises": [
"warn",
{
checksVoidReturn: false,
},
],
"@typescript-eslint/no-floating-promises": [
"warn",
{
ignoreVoid: false,
},
],
"@typescript-eslint/no-unsafe-return": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variable",
format: ["camelCase", "PascalCase"],
},
{
selector: "variable",
modifiers: ["const"],
format: ["camelCase", "PascalCase", "UPPER_CASE"],
},
{
selector: "typeLike",
format: ["PascalCase"],
},
],
"@typescript-eslint/ban-ts-comment": "off",
// no-*
"no-useless-escape": "error",
"no-empty": "error",
"no-var": "error",
"no-console": "error",
// import
"import/order": [
"error",
{
"newlines-between": "never",
},
],
"import/newline-after-import": "error",
"import/first": "error",
},
},
);