|
8 | 8 | "eslint-plugin-deprecation", |
9 | 9 | "unused-imports", |
10 | 10 | "eslint-plugin-lodash", |
11 | | - "eslint-plugin-jsonc" |
| 11 | + "eslint-plugin-jsonc", |
| 12 | + "eslint-plugin-rxjs", |
| 13 | + "eslint-plugin-simple-import-sort", |
| 14 | + "eslint-plugin-import-newlines", |
| 15 | + "eslint-plugin-jsonc", |
| 16 | + "dspace-angular-ts", |
| 17 | + "dspace-angular-html" |
| 18 | + ], |
| 19 | + "ignorePatterns": [ |
| 20 | + "lint/test/fixture" |
12 | 21 | ], |
13 | 22 | "overrides": [ |
14 | 23 | { |
|
18 | 27 | "parserOptions": { |
19 | 28 | "project": [ |
20 | 29 | "./tsconfig.json", |
21 | | - "./cypress/tsconfig.json" |
| 30 | + "./cypress/tsconfig.json", |
| 31 | + "./lint/tsconfig.json" |
22 | 32 | ], |
23 | 33 | "createDefaultProgram": true |
24 | 34 | }, |
|
27 | 37 | "plugin:@typescript-eslint/recommended", |
28 | 38 | "plugin:@typescript-eslint/recommended-requiring-type-checking", |
29 | 39 | "plugin:@angular-eslint/recommended", |
30 | | - "plugin:@angular-eslint/template/process-inline-templates" |
| 40 | + "plugin:@angular-eslint/template/process-inline-templates", |
| 41 | + "plugin:rxjs/recommended" |
31 | 42 | ], |
32 | 43 | "rules": { |
| 44 | + "indent": [ |
| 45 | + "error", |
| 46 | + 2, |
| 47 | + { |
| 48 | + "SwitchCase": 1, |
| 49 | + "ignoredNodes": [ |
| 50 | + "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key" |
| 51 | + ] |
| 52 | + } |
| 53 | + ], |
33 | 54 | "max-classes-per-file": [ |
34 | 55 | "error", |
35 | 56 | 1 |
36 | 57 | ], |
37 | 58 | "comma-dangle": [ |
38 | | - "off", |
| 59 | + "error", |
39 | 60 | "always-multiline" |
40 | 61 | ], |
| 62 | + "object-curly-spacing": [ |
| 63 | + "error", |
| 64 | + "always" |
| 65 | + ], |
41 | 66 | "eol-last": [ |
42 | 67 | "error", |
43 | 68 | "always" |
|
104 | 129 | "allowTernary": true |
105 | 130 | } |
106 | 131 | ], |
107 | | - "prefer-const": "off", // todo: re-enable & fix errors (more strict than it used to be in TSLint) |
| 132 | + "prefer-const": "error", |
| 133 | + "no-case-declarations": "error", |
| 134 | + "no-extra-boolean-cast": "error", |
108 | 135 | "prefer-spread": "off", |
109 | 136 | "no-underscore-dangle": "off", |
110 | | - |
111 | | - // todo: disabled rules from eslint:recommended, consider re-enabling & fixing |
112 | 137 | "no-prototype-builtins": "off", |
113 | 138 | "no-useless-escape": "off", |
114 | | - "no-case-declarations": "off", |
115 | | - "no-extra-boolean-cast": "off", |
116 | 139 |
|
117 | 140 | "@angular-eslint/directive-selector": [ |
118 | 141 | "error", |
|
139 | 162 | } |
140 | 163 | ], |
141 | 164 | "@angular-eslint/no-attribute-decorator": "error", |
142 | | - "@angular-eslint/no-forward-ref": "error", |
143 | 165 | "@angular-eslint/no-output-native": "warn", |
144 | 166 | "@angular-eslint/no-output-on-prefix": "warn", |
145 | 167 | "@angular-eslint/no-conflicting-lifecycle": "warn", |
| 168 | + "@angular-eslint/use-lifecycle-interface": "error", |
146 | 169 |
|
147 | 170 | "@typescript-eslint/no-inferrable-types":[ |
148 | 171 | "error", |
|
183 | 206 | ], |
184 | 207 | "@typescript-eslint/type-annotation-spacing": "error", |
185 | 208 | "@typescript-eslint/unified-signatures": "error", |
186 | | - "@typescript-eslint/ban-types": "warn", // todo: deal with {} type issues & re-enable |
| 209 | + "@typescript-eslint/ban-types": "error", |
187 | 210 | "@typescript-eslint/no-floating-promises": "warn", |
188 | 211 | "@typescript-eslint/no-misused-promises": "warn", |
189 | 212 | "@typescript-eslint/restrict-plus-operands": "warn", |
|
200 | 223 | "@typescript-eslint/no-unsafe-return": "off", |
201 | 224 | "@typescript-eslint/restrict-template-expressions": "off", |
202 | 225 | "@typescript-eslint/require-await": "off", |
| 226 | + "@typescript-eslint/no-base-to-string": [ |
| 227 | + "error", |
| 228 | + { |
| 229 | + "ignoredTypeNames": [ |
| 230 | + "ResourceType", |
| 231 | + "Error" |
| 232 | + ] |
| 233 | + } |
| 234 | + ], |
203 | 235 |
|
204 | 236 | "deprecation/deprecation": "warn", |
205 | 237 |
|
| 238 | + "simple-import-sort/imports": "error", |
| 239 | + "simple-import-sort/exports": "error", |
206 | 240 | "import/order": "off", |
| 241 | + "import/first": "error", |
| 242 | + "import/newline-after-import": "error", |
| 243 | + "import/no-duplicates": "error", |
207 | 244 | "import/no-deprecated": "warn", |
208 | 245 | "import/no-namespace": "error", |
| 246 | + "import-newlines/enforce": [ |
| 247 | + "error", |
| 248 | + { |
| 249 | + "items": 1, |
| 250 | + "semi": true, |
| 251 | + "forceSingleLine": true |
| 252 | + } |
| 253 | + ], |
| 254 | + |
209 | 255 | "unused-imports/no-unused-imports": "error", |
210 | 256 | "lodash/import-scope": [ |
211 | 257 | "error", |
212 | 258 | "method" |
213 | | - ] |
| 259 | + ], |
| 260 | + |
| 261 | + "rxjs/no-nested-subscribe": "off", // todo: go over _all_ cases |
| 262 | + |
| 263 | + // Custom DSpace Angular rules |
| 264 | + "dspace-angular-ts/themed-component-classes": "error", |
| 265 | + "dspace-angular-ts/themed-component-selectors": "error", |
| 266 | + "dspace-angular-ts/themed-component-usages": "error" |
| 267 | + } |
| 268 | + }, |
| 269 | + { |
| 270 | + "files": [ |
| 271 | + "*.spec.ts" |
| 272 | + ], |
| 273 | + "parserOptions": { |
| 274 | + "project": [ |
| 275 | + "./tsconfig.json", |
| 276 | + "./cypress/tsconfig.json" |
| 277 | + ], |
| 278 | + "createDefaultProgram": true |
| 279 | + }, |
| 280 | + "rules": { |
| 281 | + "prefer-const": "off", |
| 282 | + |
| 283 | + // Custom DSpace Angular rules |
| 284 | + "dspace-angular-ts/themed-component-usages": "error" |
214 | 285 | } |
215 | 286 | }, |
216 | 287 | { |
|
221 | 292 | "plugin:@angular-eslint/template/recommended" |
222 | 293 | ], |
223 | 294 | "rules": { |
224 | | - // todo: re-enable & fix errors |
225 | | - "@angular-eslint/template/no-negated-async": "off", |
226 | | - "@angular-eslint/template/eqeqeq": "off" |
| 295 | + // Custom DSpace Angular rules |
| 296 | + "dspace-angular-html/themed-component-usages": "error", |
| 297 | + "dspace-angular-html/no-disabled-attribute-on-button": "error", |
| 298 | + "@angular-eslint/template/prefer-control-flow": "error" |
227 | 299 | } |
228 | 300 | }, |
229 | 301 | { |
|
0 commit comments