forked from opf/openproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
172 lines (154 loc) · 5.44 KB
/
.eslintrc.js
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
module.exports = {
extends: [
"eslint:recommended",
],
env: {
browser: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./src/tsconfig.app.json",
tsconfigRootDir: __dirname,
sourceType: "module",
createDefaultProgram: true,
},
plugins: [
"@typescript-eslint",
"change-detection-strategy",
"jasmine",
],
overrides: [
{
files: ["*.ts"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./src/tsconfig.app.json",
tsconfigRootDir: __dirname,
sourceType: "module",
createDefaultProgram: true
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended",
// This is required if you use inline templates in Components
"plugin:@angular-eslint/template/process-inline-templates",
"airbnb-typescript",
],
rules: {
/**
* Any TypeScript source code (NOT TEMPLATE) related rules you wish to use/reconfigure over and above the
* recommended set provided by the @angular-eslint project would go here.
*/
"@angular-eslint/directive-selector": [
"error",
{ "type": "attribute", "prefix": ["op", "spot"], "style": "camelCase" }
],
"@angular-eslint/component-selector": [
"error",
{ "type": "element", "prefix": ["op", "spot"], "style": "kebab-case" }
],
// Warn when new components are being created without OnPush
"change-detection-strategy/on-push": "error",
"no-console": [
"error",
{
allow: [
"warn",
"error",
],
},
],
// Sometimes we need to shush the TypeScript compiler
"no-unused-vars": ["error", { "varsIgnorePattern": "^_" }],
// Who cares about line length
"max-len": "off",
// Force single quotes to align with ruby
quotes: "off",
"@typescript-eslint/quotes": ["error", "single", { avoidEscape: true }],
// Disable webpack loader definitions
"import/no-webpack-loader-syntax": "off",
// Disable order style as it's not compatible with intellij import organization
"import/order": "off",
// It'd be good if we could error this for switch cases but allow it for for loops
"no-continue": "off",
// No void at all collides with `@typescript-eslint/no-floating-promises` which wants us to handle each promise.
// Until we do that, `void` is a good way to explicitly mark unhandled promises.
"no-void": ["error", { allowAsStatement: true }],
/*
// Disable use before define, as irrelevant for TS interfaces
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "off",
*/
// Whitespace configuration
"@typescript-eslint/type-annotation-spacing": [
"error",
{
before: false,
after: false,
overrides: {
arrow: {
before: true,
after: true,
},
},
},
],
// Allow empty interfaces for naming purposes (HAL resources)
"@typescript-eslint/no-empty-interface": "off",
"import/prefer-default-export": "off",
// HAL has a lot of dangling properties, so allow
// usage in properties but not in all other places
"no-underscore-dangle": [
"warn",
{
allow: [
"_links",
"_embedded",
"_meta",
"_type",
],
allowAfterThis: true,
allowAfterSuper: false,
allowAfterThisConstructor: false,
enforceInMethodNames: true,
allowFunctionParams: true,
}
],
"no-return-assign": ["error", "except-parens"],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
//////////////////////////////////////////////////////////////////////
// Anything below this line should be turned on again at some point //
//////////////////////////////////////////////////////////////////////
// It's common in Angular to wrap even pure functions in classes for injection purposes
"class-methods-use-this": "off",
}
},
{
files: ["*.html"],
extends: ["plugin:@angular-eslint/template/recommended"],
rules: {
/**
* Any template/HTML related rules you wish to use/reconfigure over and above the
* recommended set provided by the @angular-eslint project would go here.
*/
"@angular-eslint/template/no-call-expression": 2,
}
},
{
files: ["*.spec.ts"],
extends: ["plugin:jasmine/recommended"],
rules: {
/**
* Any template/HTML related rules you wish to use/reconfigure over and above the
* recommended set provided by the @angular-eslint project would go here.
*/
// jasmine is unusable with unsafe member access, as expect(...) is always any
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
// Allow more than one class definitions per file (test components)
"max-classes-per-file": "off",
}
}
],
};