-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
.eslintrc.json
131 lines (127 loc) · 4.1 KB
/
.eslintrc.json
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
{
"env": {
"es6": true,
"node": true,
"browser": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint","import","@stylistic"],
"settings": {
"import/core-modules": [
"electron/main",
"electron/common",
"electron/renderer"
],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".mts", ".cts"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "./tsconfig.json"
}
}
},
"extends": [
"eslint:recommended",
"plugin:import/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:import/typescript"
],
"rules": {
/*** ESLint built-in rules ***/
"valid-typeof": "error",
"guard-for-in": "error",
"no-await-in-loop": "error",
"no-unmodified-loop-condition": "error",
"eqeqeq": "error",
"no-constant-binary-expression": "error",
"no-eval": "error",
"no-restricted-imports": ["error", {
"name": "electron",
"message": "This module includes APIs for all process types, which could cause runtime error on misuse. Please use 'electron/common', 'electron/main' or 'electron/renderer' to explicitly declare intended process type instead."
}],
"no-empty": ["error", { "allowEmptyCatch": true }],
/*** Stylistic rules ***/
"@stylistic/no-trailing-spaces": ["warn", {
"skipBlankLines": true,
"ignoreComments": true
}],
"@stylistic/member-delimiter-style": "warn",
"@stylistic/indent": ["warn", 2, {
"SwitchCase": 1
}],
"@stylistic/semi": "warn",
"@stylistic/quotes": ["warn", "double", {"avoidEscape": true }],
/*** TypeScript ESLint cosmetic rules ***/
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/naming-convention": ["warn",{
"selector": "variableLike",
"format": ["camelCase"]
},{
"selector": "variable",
"modifiers": ["destructured"],
"format": ["camelCase","PascalCase"]
},{
"selector": "parameter",
"format": ["camelCase"],
"modifiers": ["unused"],
"leadingUnderscore": "require"
},{
"selector": "typeLike",
"format": ["PascalCase"]
},{
"selector": "typeAlias",
"format": ["camelCase","PascalCase"]
},{
"selector": "typeParameter",
"format": ["PascalCase"],
"custom": {
"regex": "^[A-Z]$",
"match": true
}
}],
/*** TypeScript ESLint plugin rules ***/
"@typescript-eslint/switch-exhaustiveness-check": "warn",
"@typescript-eslint/strict-boolean-expressions": ["error", {
"allowString": false,
"allowNumber": false
}],
"@typescript-eslint/no-confusing-void-expression": ["warn", {
"ignoreArrowShorthand": true
}],
"@typescript-eslint/consistent-type-assertions": ["error", {
"assertionStyle": "as",
"objectLiteralTypeAssertions": "never"
}],
"@typescript-eslint/no-meaningless-void-operator": ["error", {
"checkNever": true
}],
"@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
// Same as in TSC.
"@typescript-eslint/no-unused-vars": "error",
// Interfaces compile faster.
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
// RegExp.prototype.exec might run faster, according to TypeScript ESLint.
"@typescript-eslint/prefer-regexp-exec": "error",
/*** Import plugin rules ***/
"import/no-unused-modules": ["error", {
"unusedExports": true
}],
"import/no-unresolved": ["error", {
"ignore": ["^(node:)?original-fs$"]
}]
}
}