|
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 | + "dspace-angular-ts", |
| 16 | + "dspace-angular-html" |
| 17 | + ], |
| 18 | + "ignorePatterns": [ |
| 19 | + "lint/test/fixture" |
12 | 20 | ], |
13 | 21 | "overrides": [ |
14 | 22 | { |
|
18 | 26 | "parserOptions": { |
19 | 27 | "project": [ |
20 | 28 | "./tsconfig.json", |
21 | | - "./cypress/tsconfig.json" |
| 29 | + "./cypress/tsconfig.json", |
| 30 | + "./lint/tsconfig.json" |
22 | 31 | ], |
23 | 32 | "createDefaultProgram": true |
24 | 33 | }, |
|
27 | 36 | "plugin:@typescript-eslint/recommended", |
28 | 37 | "plugin:@typescript-eslint/recommended-requiring-type-checking", |
29 | 38 | "plugin:@angular-eslint/recommended", |
30 | | - "plugin:@angular-eslint/template/process-inline-templates" |
| 39 | + "plugin:@angular-eslint/template/process-inline-templates", |
| 40 | + "plugin:rxjs/recommended" |
31 | 41 | ], |
32 | 42 | "rules": { |
| 43 | + "indent": [ |
| 44 | + "error", |
| 45 | + 2, |
| 46 | + { |
| 47 | + "SwitchCase": 1, |
| 48 | + "ignoredNodes": [ |
| 49 | + "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key" |
| 50 | + ] |
| 51 | + } |
| 52 | + ], |
33 | 53 | "max-classes-per-file": [ |
34 | 54 | "error", |
35 | 55 | 1 |
36 | 56 | ], |
37 | 57 | "comma-dangle": [ |
38 | | - "off", |
| 58 | + "error", |
39 | 59 | "always-multiline" |
40 | 60 | ], |
| 61 | + "object-curly-spacing": [ |
| 62 | + "error", |
| 63 | + "always" |
| 64 | + ], |
41 | 65 | "eol-last": [ |
42 | 66 | "error", |
43 | 67 | "always" |
|
104 | 128 | "allowTernary": true |
105 | 129 | } |
106 | 130 | ], |
107 | | - "prefer-const": "off", // todo: re-enable & fix errors (more strict than it used to be in TSLint) |
| 131 | + "prefer-const": "error", |
| 132 | + "no-case-declarations": "error", |
| 133 | + "no-extra-boolean-cast": "error", |
108 | 134 | "prefer-spread": "off", |
109 | 135 | "no-underscore-dangle": "off", |
110 | | - |
111 | | - // todo: disabled rules from eslint:recommended, consider re-enabling & fixing |
112 | 136 | "no-prototype-builtins": "off", |
113 | 137 | "no-useless-escape": "off", |
114 | | - "no-case-declarations": "off", |
115 | | - "no-extra-boolean-cast": "off", |
116 | 138 |
|
117 | 139 | "@angular-eslint/directive-selector": [ |
118 | 140 | "error", |
|
138 | 160 | ] |
139 | 161 | } |
140 | 162 | ], |
| 163 | + "@angular-eslint/prefer-standalone": [ |
| 164 | + "error" |
| 165 | + ], |
141 | 166 | "@angular-eslint/no-attribute-decorator": "error", |
142 | | - "@angular-eslint/no-forward-ref": "error", |
143 | 167 | "@angular-eslint/no-output-native": "warn", |
144 | 168 | "@angular-eslint/no-output-on-prefix": "warn", |
145 | 169 | "@angular-eslint/no-conflicting-lifecycle": "warn", |
| 170 | + "@angular-eslint/use-lifecycle-interface": "error", |
146 | 171 |
|
147 | 172 | "@typescript-eslint/no-inferrable-types":[ |
148 | 173 | "error", |
|
183 | 208 | ], |
184 | 209 | "@typescript-eslint/type-annotation-spacing": "error", |
185 | 210 | "@typescript-eslint/unified-signatures": "error", |
186 | | - "@typescript-eslint/ban-types": "warn", // todo: deal with {} type issues & re-enable |
| 211 | + "@typescript-eslint/ban-types": "error", |
187 | 212 | "@typescript-eslint/no-floating-promises": "warn", |
188 | 213 | "@typescript-eslint/no-misused-promises": "warn", |
189 | 214 | "@typescript-eslint/restrict-plus-operands": "warn", |
|
200 | 225 | "@typescript-eslint/no-unsafe-return": "off", |
201 | 226 | "@typescript-eslint/restrict-template-expressions": "off", |
202 | 227 | "@typescript-eslint/require-await": "off", |
| 228 | + "@typescript-eslint/no-base-to-string": [ |
| 229 | + "error", |
| 230 | + { |
| 231 | + "ignoredTypeNames": [ |
| 232 | + "ResourceType", |
| 233 | + "Error" |
| 234 | + ] |
| 235 | + } |
| 236 | + ], |
203 | 237 |
|
204 | 238 | "deprecation/deprecation": "warn", |
205 | 239 |
|
| 240 | + "simple-import-sort/imports": "error", |
| 241 | + "simple-import-sort/exports": "error", |
206 | 242 | "import/order": "off", |
| 243 | + "import/first": "error", |
| 244 | + "import/newline-after-import": "error", |
| 245 | + "import/no-duplicates": "error", |
207 | 246 | "import/no-deprecated": "warn", |
208 | 247 | "import/no-namespace": "error", |
| 248 | + "import-newlines/enforce": [ |
| 249 | + "error", |
| 250 | + { |
| 251 | + "items": 1, |
| 252 | + "semi": true, |
| 253 | + "forceSingleLine": true |
| 254 | + } |
| 255 | + ], |
| 256 | + |
209 | 257 | "unused-imports/no-unused-imports": "error", |
210 | 258 | "lodash/import-scope": [ |
211 | 259 | "error", |
212 | 260 | "method" |
| 261 | + ], |
| 262 | + |
| 263 | + "rxjs/no-nested-subscribe": "off", // todo: go over _all_ cases |
| 264 | + |
| 265 | + // Custom DSpace Angular rules |
| 266 | + "dspace-angular-ts/alias-imports": [ |
| 267 | + "error", |
| 268 | + { |
| 269 | + "aliases": [ |
| 270 | + { |
| 271 | + "package": "rxjs", |
| 272 | + "imported": "of", |
| 273 | + "local": "of" |
| 274 | + } |
| 275 | + ] |
| 276 | + } |
| 277 | + ], |
| 278 | + "dspace-angular-ts/themed-component-classes": "error", |
| 279 | + "dspace-angular-ts/themed-component-selectors": "error", |
| 280 | + "dspace-angular-ts/themed-component-usages": "error", |
| 281 | + "dspace-angular-ts/themed-decorators": [ |
| 282 | + "off", |
| 283 | + { |
| 284 | + "decorators": { |
| 285 | + "listableObjectComponent": 3, |
| 286 | + "rendersSectionForMenu": 2 |
| 287 | + } |
| 288 | + } |
| 289 | + ], |
| 290 | + "dspace-angular-ts/themed-wrapper-no-input-defaults": "error", |
| 291 | + "dspace-angular-ts/unique-decorators": [ |
| 292 | + "off", |
| 293 | + { |
| 294 | + "decorators": [ |
| 295 | + "listableObjectComponent" |
| 296 | + ] |
| 297 | + } |
| 298 | + ], |
| 299 | + "dspace-angular-ts/sort-standalone-imports": [ |
| 300 | + "error", |
| 301 | + { |
| 302 | + "locale": "en-US", |
| 303 | + "maxItems": 0, |
| 304 | + "indent": 2, |
| 305 | + "trailingComma": true |
| 306 | + } |
213 | 307 | ] |
214 | 308 | } |
215 | 309 | }, |
| 310 | + { |
| 311 | + "files": [ |
| 312 | + "*.spec.ts" |
| 313 | + ], |
| 314 | + "parserOptions": { |
| 315 | + "project": [ |
| 316 | + "./tsconfig.json", |
| 317 | + "./cypress/tsconfig.json" |
| 318 | + ], |
| 319 | + "createDefaultProgram": true |
| 320 | + }, |
| 321 | + "rules": { |
| 322 | + "prefer-const": "off", |
| 323 | + |
| 324 | + // Custom DSpace Angular rules |
| 325 | + "dspace-angular-ts/themed-component-usages": "error" |
| 326 | + } |
| 327 | + }, |
216 | 328 | { |
217 | 329 | "files": [ |
218 | 330 | "*.html" |
|
221 | 333 | "plugin:@angular-eslint/template/recommended" |
222 | 334 | ], |
223 | 335 | "rules": { |
224 | | - // todo: re-enable & fix errors |
225 | | - "@angular-eslint/template/no-negated-async": "off", |
226 | | - "@angular-eslint/template/eqeqeq": "off" |
| 336 | + // Custom DSpace Angular rules |
| 337 | + "dspace-angular-html/themed-component-usages": "error", |
| 338 | + "dspace-angular-html/no-disabled-attribute-on-button": "error", |
| 339 | + "@angular-eslint/template/prefer-control-flow": "error" |
227 | 340 | } |
228 | 341 | }, |
229 | 342 | { |
230 | 343 | "files": [ |
231 | 344 | "*.json5" |
232 | 345 | ], |
233 | 346 | "extends": [ |
234 | | - "plugin:jsonc/recommended-with-jsonc" |
| 347 | + "plugin:jsonc/recommended-with-json5" |
235 | 348 | ], |
236 | 349 | "rules": { |
237 | | - "no-irregular-whitespace": "error", |
| 350 | + // The ESLint core no-irregular-whitespace rule doesn't work well in JSON |
| 351 | + // See: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-irregular-whitespace.html |
| 352 | + "no-irregular-whitespace": "off", |
| 353 | + "jsonc/no-irregular-whitespace": "error", |
238 | 354 | "no-trailing-spaces": "error", |
239 | 355 | "jsonc/comma-dangle": [ |
240 | 356 | "error", |
|
0 commit comments