forked from kakxem/WebCord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
123 lines (119 loc) · 4.11 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
{
"env": {
"es6": true,
"node": true,
"browser": true
},
"overrides": [
// JSON linting
{
"files": ["*.json"],
"plugins": ["json-schema-validator"],
"extends": ["plugin:json-schema-validator/recommended"]
},
// TypeScript linting
{
"files": ["*.ts", "*.mts", "*.cts"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint","import"],
"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-requiring-type-checking",
"plugin:@typescript-eslint/strict",
"plugin:import/typescript"
],
"rules": {
/*** ESLint cosmetic rules ***/
"no-trailing-spaces": ["warn", {
"skipBlankLines": true,
"ignoreComments": true
}],
// Broken rules with TypeScript
"camelcase": "off",
"indent": "off",
"semi": "off",
"quotes": "off",
/*** 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 does not provide the information about the process type. Please use 'electron/common', 'electron/main' or 'electron/renderer' instead."
}],
/*** TypeScript ESLint cosmetic rules ***/
"@typescript-eslint/member-delimiter-style": "warn",
"@typescript-eslint/indent": ["warn", 2, {
"SwitchCase": 1
}],
"@typescript-eslint/semi": "warn",
"@typescript-eslint/quotes": ["warn", "double", {"avoidEscape": true }],
// TODO: Define naming conventions (to replace camelcase rule).
/*"@typescript-eslint/naming-convention": ["warn", {
"selector": "default",
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "allow"
},{
"selector": "property",
"format": ["camelCase", "PascalCase","UPPER_CASE","snake_case"],
"leadingUnderscore": "forbid"
}],*/
/*** 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"],
/*** Import plugin rules ***/
"import/no-unused-modules": ["error", {
"unusedExports": true
}]
}
}
]
}