-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.json
150 lines (150 loc) · 6.94 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{
"root": true,
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": true,
"createDefaultProgram": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:@angular-eslint/all",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/component-max-inline-declarations": "off", // We use that mostly for testing, so it's fine
"@angular-eslint/no-forward-ref": "off", // We sometimes need it
"@angular-eslint/prefer-on-push-component-change-detection": "off",
"@angular-eslint/use-component-selector": "off", // Some components are not template-able and thus do not need selector
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/no-confusing-void-expression": "off", // Don't create unncessary closure and we prefer code tersity anyway
"@typescript-eslint/no-dynamic-delete": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extraneous-class": "off", // We have component without any logic in TS
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unnecessary-condition": "off", // This is very unfortunate, but there are too many dangerous false-positive, see https://github.com/typescript-eslint/typescript-eslint/issues/1798
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off", // Usually a good idea, but sometimes dangerous false-positive
"@typescript-eslint/unbound-method": "off",
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
"allowArgumentsExplicitlyTypedAsAny": true
}
],
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": {
// We want to use promise in Rxjs subscribes without caring about the promise result
"arguments": false,
"properties": false
}
}
],
"@typescript-eslint/restrict-plus-operands": [
"error",
{
// Allow some flexibility
"allowAny": true,
"allowBoolean": true,
"allowNullish": true,
"allowNumberAndString": true
}
],
"@typescript-eslint/restrict-template-expressions": [
"error",
{
// Allow some flexibility
"allowAny": true,
"allowBoolean": true,
"allowNullish": true,
"allowNumber": true
}
],
"@typescript-eslint/no-unused-expressions": [
"error",
{
"allowTernary": true
}
],
"@typescript-eslint/no-unused-vars": [
"error",
{
"caughtErrors": "none"
}
],
"no-restricted-globals": [
"error",
"atob",
"bota",
"document",
"event",
"history",
"length",
"localStorage",
"location",
"name",
"navigator",
"sessionStorage",
"window"
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/all"],
"rules": {
"@angular-eslint/template/alt-text": "off", // We don't care as much as we should about a11y
"@angular-eslint/template/attributes-order": "off", // TODO: We want to enable this, but autofix mess up our code, and it's too much manual changes
"@angular-eslint/template/button-has-type": "off",
"@angular-eslint/template/click-events-have-key-events": "off", // We don't care as much as we should about a11y
"@angular-eslint/template/i18n": "off",
"@angular-eslint/template/interactive-supports-focus": "off", // We don't care as much as we should about a11y
"@angular-eslint/template/label-has-associated-control": "off", // We don't care as much as we should about a11y
"@angular-eslint/template/no-any": "off", // Unfortunately, some libs force us to use this
"@angular-eslint/template/no-autofocus": "off",
"@angular-eslint/template/no-call-expression": "off",
"@angular-eslint/template/no-inline-styles": "off", // We sometimes use short inlie styles
"@angular-eslint/template/prefer-ngsrc": "off", // TODO: experiment with ngsrc and see if we need to use it or not
"@angular-eslint/template/eqeqeq": [
"error",
{
"allowNullOrUndefined": true
}
]
}
}
]
}