eslint-config-beslogic 4.3.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.dprint.jsonc CHANGED
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // Copyright 2024 Beslogic Inc.
2
+ // Copyright 2025 Beslogic Inc.
3
3
 
4
4
  {
5
5
  // https://dprint.dev/config/#extending-a-different-configuration-file
package/CHANGELOG.md CHANGED
@@ -1,5 +1,82 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.0.0
4
+
5
+ - Dropped support for ESLint v8
6
+ - Note that we'll no longer be supporting the `ESLint-Config-Beslogic@v3` branch with the old-style configs
7
+ - Speedup due to removing compatibility layers
8
+ - Dropped support for Angular v18
9
+ - Removed all `languageOptions.parserOptions.project` configs in favor of `languageOptions.parserOptions.projectService: true`
10
+ - Using `eslint-plugin-import-x`'s new resolver system
11
+ - Wrapped `eslint-plugin-extra-rules` in `fixupPluginRules` to fix `extra-rules/potential-point-free` on ESLint v9
12
+ - Exposed a pre-configured object for `@typescript-eslint/explicit-module-boundary-types` for libraries
13
+ - Let `eslint-plugin-n` completely configure `languageOptions` for Node (with automatic ESM vs CommonJS detection)
14
+ - Added names to all config objects
15
+
16
+ ### Rule configuration changes
17
+
18
+ Given the nature of extending `all` and `recommended` configurations by default, I won't be listing all new rules here.
19
+
20
+ - `no-relative-import-paths/no-relative-import-paths`: Allow 1 parent level in imports
21
+ - Enabled `n/no-top-level-await`, but with `ignoreBin: true`. The rule can be bypassed by setting a hash-bang comment to your script files
22
+ - Stylistic: Try to get `@stylistic/indent` to match DPrint a bit more on nested ternary expressions
23
+ - Stylistic: Allow extra parents on nested conditional/ternary expressions
24
+ - Disallow `unknown` in `@typescript-eslint/no-base-to-string`, `@typescript-eslint/only-throw-error` and `"@typescript-eslint/prefer-promise-reject-errors`
25
+ - Disallow `any` in `@typescript-eslint/no-base-to-string`, `@typescript-eslint/only-throw-error` and `"@typescript-eslint/prefer-promise-reject-errors` in extra-strict preset
26
+ - Enabled `@typescript-eslint/prefer-nullish-coalescing` in non-strict preset, but with leaner configs. Should do nothing if `StrictNullChecks` is not enabled in your `tsconfig.json`
27
+ - Allow `while(true)` for `@typescript-eslint/no-unnecessary-condition`
28
+ - Enable autofixes for `no-new-native-nonconstructor`
29
+ - Added `reportUsedIgnorePattern: true` to `autofix/no-unused-vars`
30
+ - Updated rule `no-fallthrough` with `{commentPattern: "/(falls?\s?through|defaults?)/i", "reportUnusedFallthroughComment": true}`
31
+ - Rule `rxjs/no-finnish` was moved from the Angular preset to the RxJS preset
32
+ - Enabled rule `testing-library/no-test-id-queries` as warning in extra-strict preset
33
+ - Angular lifecycle hook prototype methods are now checked using `@angular-eslint/require-lifecycle-on-prototype` rather than `no-restricted-syntax`
34
+ - New `no-restricted-syntax` rule to enforce naming eslint configuration objects when using `defineConfig`
35
+ - Added some custom `no-restricted-syntax` from <https://typescript-eslint.io/troubleshooting/faqs/general/#how-can-i-ban-specific-language-feature>:
36
+ - Ban accessing `constructor.name`
37
+ - Ban static `this`
38
+ - Ban `const` enums. This replaces `etc/no-const-enum`
39
+
40
+ Disabled rules:
41
+
42
+ - Disabled rule `@angular-eslint/no-conflicting-lifecycle`
43
+ - Disabled rule `unicorn/better-regex`
44
+ - Dropped `eslint-plugin-etc`. All the interesting rules now have an equivalent in other plugins
45
+ - Disabled `@eslint-community/eslint-comments/no-unused-disable` rule in favor of `linterOptions.reportUnusedDisableDirectives`
46
+
47
+ ### Dependency updates
48
+
49
+ #### Necessary to ensure proper ESLint v9 compatibility
50
+
51
+ - Migrated from `eslint-plugin-rxjs@^5.0.3` to `eslint-plugin-rxjs-angular-x@^0.1.0`
52
+ - Migrated from `"github:BesLogic/eslint-plugin-rxjs-angular#dist` to `eslint-plugin-rxjs-x@^0.8`
53
+ - Migrated `eslint-plugin-jest-formatting` to `eslint-plugin-jest`
54
+ - Bumped `eslint` to `^9.12`
55
+ - Bumped `eslint-plugin-jest` to `^28.8.3 || ^29.0.1`
56
+ - Bumped `eslint-plugin-sonarjs` tot `^3.0.2`
57
+ - Bumped `eslint-plugin-unicorn` to `^56.0.1`
58
+ - Bumped `eslint-plugin-react-redux` to `^4.2.0`
59
+ - Bumped `eslint-plugin-testing-library` `^7.2.0`
60
+ - Bumped `@eslint-community/eslint-plugin-eslint-comments` to `^4.3`
61
+ - Bumped `eslint-plugin-autofix` to `^2.2`
62
+ - Bumped `eslint-plugin-jsx-a11y` to `^6.10.0`
63
+ - Bumped `eslint-plugin-regexp` to `^2.3`
64
+
65
+ #### Necessary for unconditional support of new features and configs
66
+
67
+ - Bumped `eslint-plugin-no-autofix` to `^2.1`
68
+ - Bumped `@eslint/compat` to `^1.2.4 || ^2`
69
+ - Bumped `@stylistic/eslint-plugin` to `^5.3`
70
+ - Bumped `eslint-config-flat-gitignore` to `^2.1.0`
71
+ - Bumped `eslint-import-resolver-typescript` to `^4`
72
+ - Bumped `eslint-plugin-import-x` to `^4.15.1`
73
+ - Bumped `eslint-plugin-no-relative-import-paths` to `^1.5.5`
74
+ - Bumped `typescript-eslint` to `^8.35`
75
+ - Bumped `angular-eslint` to `>=19.6`
76
+ - Bumped `eslint-plugin-n` to `>=17.19`
77
+ - Bumped `eslint-plugin-react-hooks` to `^7.0.1`
78
+ - Bumped `eslint-plugin-react-prefer-function-component` to `^3.3.0 || ^4.0.1 || ^5`
79
+
3
80
  ## 4.3.2
4
81
 
5
82
  - Disabled `@angular-eslint/no-host-metadata-property` as it is now the recommendation for signals. See <https://github.com/angular-eslint/angular-eslint/discussions/2303>
@@ -8,7 +85,7 @@
8
85
  ## 4.3.0
9
86
 
10
87
  - Correctly also disable `compilerOptions.emitDecoratorMetadata` when disabling `compilerOptions.experimentalDecorators` out of the box
11
- - Added instructions to explicitely enable both on Angular projects using experimental decorators
88
+ - Added instructions to explicitly enable both on Angular projects using experimental decorators
12
89
  - Added a `tsconfig.5.6.json` TSConfig preset with `noUncheckedSideEffectImports` enabled
13
90
  - Enabled `compilerOptions.resolveJsonModule` by default
14
91
  - Enabled `compilerOptions.checkJS` by default
@@ -35,7 +112,7 @@
35
112
  - Disabled `@typescript-eslint/no-misused-spread`:\
36
113
  Still a handful of false-positives and I couldn't get the configuration working.\
37
114
  Especially annoying with autogenerated API when spreading class instance
38
- with readonly properties as its contructor object.\
115
+ with readonly properties as its constructor object.\
39
116
  ie: `new Myclass({...someInstance, overwritten_prop: "foo"})`\
40
117
  NOTE: If fixed, we'd still only want this in extra-strict config.
41
118
 
@@ -83,7 +160,7 @@
83
160
  - Disabled `@typescript-eslint/no-misused-spread`:\
84
161
  Still a handful of false-positives and I couldn't get the configuration working.\
85
162
  Especially annoying with autogenerated API when spreading class instance
86
- with readonly properties as its contructor object.\
163
+ with readonly properties as its constructor object.\
87
164
  ie: `new Myclass({...someInstance, overwritten_prop: "foo"})`\
88
165
  NOTE: If fixed, we'd still only want this in extra-strict config.
89
166
 
@@ -122,7 +199,7 @@
122
199
 
123
200
  ## 3.1.1
124
201
 
125
- - Turned on `"objectLiteralTypeAssertions": "allow-as-parameter"` as error for `@typescript-eslint/consistent-type-assertions` in extra-strict config
202
+ - Turned on `"objectLiteralTypeAssertions` to `allow-as-parameter"` as error for `@typescript-eslint/consistent-type-assertions` in extra-strict config
126
203
  - Enabled `@typescript-eslint/consistent-type-assertions` (but without the "as parameter" restriction) for Jest
127
204
  - Added `boolean` and `nullish` to `@typescript-eslint/restrict-template-expressions` in `extra-strict` preset
128
205
  If you really meant to write "true", "false", "null" or "undefined", then explicitly stringify it using `String()` (or `Intl.ListFormat` for `Array`s)
@@ -220,7 +297,7 @@
220
297
 
221
298
  ## 2.4.12
222
299
 
223
- - Restored `regexp/prefer-d` pre-2.4 behaviour of prefering `/[\d_]/` over `/[0-9_]/`
300
+ - Restored `regexp/prefer-d` pre-2.4 behaviour of preferring `/[\d_]/` over `/[0-9_]/`
224
301
  - Disabled all the following rules when running under pre-commit.ci to avoid false-positives due to missing types:
225
302
  - `@typescript-eslint/no-redundant-type-constituents`
226
303
  - `@typescript-eslint/no-unnecessary-condition`
@@ -240,12 +317,12 @@
240
317
 
241
318
  ## 2.4.7
242
319
 
243
- - No longer recommending to explicitely annotate void returning awaitable arrow functions as `(param): void => { statement }` in JavaScript
320
+ - No longer recommending to explicitly annotate void returning awaitable arrow functions as `(param): void => { statement }` in JavaScript
244
321
 
245
322
  ## 2.4.6
246
323
 
247
324
  - Replaced `@typescript-eslint/*` with `typescript-eslint`
248
- - Loosened rules requirering `strictNullChecks` if `eslint-plugin-total-functions` isn't also installed
325
+ - Loosened rules requiring `strictNullChecks` if `eslint-plugin-total-functions` isn't also installed
249
326
 
250
327
  ## 2.4.5
251
328
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright 2024 Beslogic Inc.
3
+ Copyright 2025 Beslogic Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -107,12 +107,12 @@ Examples
107
107
  <summary>React + TypeScript</summary>
108
108
 
109
109
  ```js
110
- import tseslint from 'typescript-eslint'
110
+ import { defineConfig } from 'eslint/config';
111
111
  import beslogicExtraStrict from 'eslint-config-beslogic/extra-strict.mjs'
112
112
  import beslogicReact from 'eslint-config-beslogic/react.mjs'
113
113
  import beslogicTypeScript from 'eslint-config-beslogic/typescript.mjs'
114
114
 
115
- export default tseslint.config(
115
+ export default defineConfig(
116
116
  beslogicReact,
117
117
  beslogicTypeScript,
118
118
  beslogicExtraStrict,
@@ -127,11 +127,11 @@ export default tseslint.config(
127
127
  <summary>Angular</summary>
128
128
 
129
129
  ```js
130
- import tseslint from 'typescript-eslint'
130
+ import { defineConfig } from 'eslint/config';
131
131
  import beslogicAngular from 'eslint-config-beslogic/angular.mjs'
132
132
  import beslogicExtraStrict from 'eslint-config-beslogic/extra-strict.mjs'
133
133
 
134
- export default tseslint.config(
134
+ export default defineConfig(
135
135
  beslogicAngular,
136
136
  beslogicExtraStrict,
137
137
  // Your configs here
@@ -145,13 +145,13 @@ export default tseslint.config(
145
145
  <summary>Frameworkless TypeScript w/o dprint</summary>
146
146
 
147
147
  ```js
148
- import tseslint from 'typescript-eslint'
148
+ import { defineConfig } from 'eslint/config';
149
149
  import beslogicExtraStrict from 'eslint-config-beslogic/extra-strict.mjs'
150
150
  import beslogicJavascript from 'eslint-config-beslogic/javascript.mjs'
151
151
  import beslogicStylistic from 'eslint-config-beslogic/stylistic.mjs'
152
152
  import beslogicTypeScript from 'eslint-config-beslogic/typescript.mjs'
153
153
 
154
- export default tseslint.config(
154
+ export default defineConfig(
155
155
  beslogicJavascript,
156
156
  beslogicTypeScript,
157
157
  beslogicExtraStrict,
@@ -177,12 +177,29 @@ Basic javascript configs, is extended by all other configs except `typescript.mj
177
177
 
178
178
  ### `typescript.mjs`
179
179
 
180
- Basic TypeScript-specific configs and `TSX` support, is extended by all other TypeScript exclusive configs. To avoid rules conflicts, it does **not** already extend from `javascript.mjs`. So you should extend from both in a pure TypeScript project. You may also need to specify `parserOptions.project`. ie: `"parserOptions": { "project": ["tsconfig.json"] },` and `"parser": "@typescript-eslint/parser"` if you reconfigure some rules yourself.
180
+ Basic TypeScript-specific configs and `TSX` support, is extended by all other TypeScript exclusive configs. To avoid rules conflicts, it does **not** already extend from `javascript.mjs`. So you should extend from both in a pure TypeScript project. If you have a non-standard `tsconfig.json`, you may need custom configurations for [settings.import-x/resolver-next: [createTypeScriptImportResolver({project: ...})]](https://github.com/import-js/eslint-import-resolver-typescript#eslintconfigjs) and/or [settings.parserOptions.projectService](https://typescript-eslint.io/packages/parser#projectserviceoptions).
181
181
 
182
182
  For the linting to be fully effective, please make sure that your base `tsconfig.json` extends `eslint-config-beslogic/tsconfig.X.X.json` (see [Parallel configurations](#parallel-configurations)).
183
183
 
184
184
  If you want extra strict linting, consider adding the [`extra-strict.mjs` preset](#extra-strictmjs).
185
185
 
186
+ If you are a writing library, use the following rule:
187
+
188
+ ```js
189
+ import { defineConfig } from "eslint/config"
190
+ import { explicitModuleBoundaryType } from "eslint-config-beslogic/extra-strict.mjs"
191
+
192
+ export default defineConfig(
193
+ {
194
+ rules: {
195
+ "@typescript-eslint/explicit-module-boundary-types": explicitModuleBoundaryType
196
+ }
197
+ }
198
+ )
199
+ ```
200
+
201
+ <!-- Notes about bun support for later: https://github.com/import-js/eslint-import-resolver-typescript#bun-->
202
+
186
203
  ### `node-js.mjs`
187
204
 
188
205
  Configurations for NodeJS backends.
@@ -200,7 +217,7 @@ Configurations for projects using RxJs. Already extends and `typescript.mjs` for
200
217
  Add the following `devDependencies` to your `package.json`:
201
218
 
202
219
  ```shell
203
- npm install --save-dev eslint-plugin-rxjs
220
+ npm install --save-dev eslint-plugin-rxjs-x
204
221
  ```
205
222
 
206
223
  ### `react.mjs`
@@ -255,9 +272,11 @@ If bundling as an npm package set `"strictMetadataEmit": true` under `angularCom
255
272
  Add the following `devDependencies` to your `package.json`:
256
273
 
257
274
  ```shell
258
- npm install --save-dev @angular-eslint/eslint-plugin @angular-eslint/eslint-plugin-template @angular-eslint/template-parser github:BesLogic/eslint-plugin-rxjs-angular#dist eslint-plugin-angular-file-naming
275
+ npm install --save-dev @angular-eslint/eslint-plugin @angular-eslint/eslint-plugin-template @angular-eslint/template-parser eslint-plugin-rxjs-angular-x eslint-plugin-angular-file-naming
259
276
  ```
260
277
 
278
+ If using Standalone Components, which are now the recommended default, you should enable the rule `"no-autofix/@angular-eslint/prefer-standalone": "error"`.
279
+
261
280
  ### `storybook.mjs`
262
281
 
263
282
  Includes strict Storybook ESLint plugin and a custom rule for Angular components. This preset should be added last.\
@@ -292,13 +311,3 @@ Enforces stylistic rules for JS objects to look like valid JSON objects.
292
311
  ## Changelog
293
312
 
294
313
  You can view the changelog under the [Code Tab](https://www.npmjs.com/package/eslint-config-beslogic?activeTab=code), or at <https://socket.dev/npm/package/eslint-config-beslogic/files/latest/CHANGELOG.md>
295
-
296
- <!-- (keep this section hidden from public README)
297
- ## Dev testing:
298
-
299
- To test updates to ESLint-Config-Beslogic in other existing projects:
300
- 1. At the root of this repo, run `npm i` then `npm run yalc`
301
- 2. In the target project, run `npm i --save-dev yalc` then `yalc add eslint-config-beslogic`
302
- 3. Update the project's eslintrc.config.mjs config file as needed
303
- 4. Run your linting
304
- -->
@@ -1,8 +1,5 @@
1
1
  // These are the rules I haven't yet validated if they duplicate existing rules
2
2
  {
3
- "sonarjs/alt-text": "error",
4
- "sonarjs/anchor-has-content": "error",
5
- "sonarjs/anchor-is-valid": "error",
6
3
  "sonarjs/anchor-precedence": "error",
7
4
  "sonarjs/argument-type": "error",
8
5
  "sonarjs/arguments-order": "error",
@@ -35,29 +32,24 @@
35
32
  "sonarjs/generator-without-yield": "error",
36
33
  "sonarjs/hashing": "error",
37
34
  "sonarjs/hidden-files": "error",
38
- "sonarjs/html-has-lang": "error",
39
35
  "sonarjs/in-operator-type-error": "error",
40
36
  "sonarjs/inconsistent-function-call": "error",
41
37
  "sonarjs/index-of-compare-to-positive-number": "error",
42
38
  "sonarjs/insecure-cookie": "error",
43
39
  "sonarjs/insecure-jwt-token": "error",
44
40
  "sonarjs/inverted-assertion-arguments": "error",
45
- "sonarjs/label-has-associated-control": "error",
46
41
  "sonarjs/label-position": "error",
47
42
  "sonarjs/link-with-target-blank": "error",
48
43
  "sonarjs/max-switch-cases": "error",
49
- "sonarjs/media-has-caption": "error",
50
44
  "sonarjs/misplaced-loop-counter": "error",
51
45
  "sonarjs/mouse-events-a11y": "error",
52
46
  "sonarjs/new-operator-misuse": "error",
53
47
  "sonarjs/no-accessor-field-mismatch": "error",
54
48
  "sonarjs/no-all-duplicated-branches": "error",
55
- "sonarjs/no-alphabetical-sort": "error",
56
49
  "sonarjs/no-angular-bypass-sanitization": "error",
57
50
  "sonarjs/no-array-delete": "error",
58
51
  "sonarjs/no-associative-arrays": "error",
59
52
  "sonarjs/no-async-constructor": "error",
60
- "sonarjs/no-base-to-string": "error",
61
53
  "sonarjs/no-case-label-in-switch": "error",
62
54
  "sonarjs/no-clear-text-protocols": "error",
63
55
  "sonarjs/no-code-after-done": "error",
@@ -88,19 +80,16 @@
88
80
  "sonarjs/no-infinite-loop": "error",
89
81
  "sonarjs/no-internal-api-use": "error",
90
82
  "sonarjs/no-intrusive-permissions": "error",
91
- "sonarjs/no-invalid-await": "error",
92
83
  "sonarjs/no-invariant-returns": "error",
93
84
  "sonarjs/no-inverted-boolean-check": "error",
94
85
  "sonarjs/no-ip-forward": "error",
95
86
  "sonarjs/no-labels": "error",
96
87
  "sonarjs/no-literal-call": "error",
97
88
  "sonarjs/no-mime-sniff": "error",
98
- "sonarjs/no-misleading-array-reverse": "error",
99
89
  "sonarjs/no-mixed-content": "error",
100
90
  "sonarjs/no-nested-assignment": "error",
101
91
  "sonarjs/no-nested-functions": "error",
102
92
  "sonarjs/no-nested-template-literals": "error",
103
- "sonarjs/no-one-iteration-loop": "error",
104
93
  "sonarjs/no-parameter-reassignment": "error",
105
94
  "sonarjs/no-primitive-wrappers": "error",
106
95
  "sonarjs/no-redundant-assignments": "error",
@@ -111,8 +100,6 @@
111
100
  "sonarjs/no-same-argument-assert": "error",
112
101
  "sonarjs/no-same-line-conditional": "error",
113
102
  "sonarjs/no-selector-parameter": "error",
114
- "sonarjs/no-self-compare": "error",
115
- "sonarjs/no-self-import": "error",
116
103
  "sonarjs/no-skipped-test": "error",
117
104
  "sonarjs/no-small-switch": "error",
118
105
  "sonarjs/no-table-as-layout": "error",
@@ -123,8 +110,6 @@
123
110
  "sonarjs/no-unthrown-error": "error",
124
111
  "sonarjs/no-unused-collection": "error",
125
112
  "sonarjs/no-use-of-empty-return-value": "error",
126
- "sonarjs/no-useless-call": "error",
127
- "sonarjs/no-useless-constructor": "error",
128
113
  "sonarjs/no-useless-increment": "error",
129
114
  "sonarjs/no-useless-intersection": "error",
130
115
  "sonarjs/no-vue-bypass-sanitization": "error",
@@ -136,8 +121,6 @@
136
121
  "sonarjs/os-command": "error",
137
122
  "sonarjs/post-message": "error",
138
123
  "sonarjs/prefer-default-last": "error",
139
- "sonarjs/prefer-function-type": "error",
140
- "sonarjs/prefer-namespace-keyword": "error",
141
124
  "sonarjs/prefer-promise-shorthand": "error",
142
125
  "sonarjs/prefer-single-boolean-return": "error",
143
126
  "sonarjs/prefer-type-guard": "error",
package/angular.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // Copyright 2024 Beslogic Inc.
2
+ // Copyright 2025 Beslogic Inc.
3
3
 
4
+ import { defineConfig } from "@eslint/config-helpers"
4
5
  import angular from "angular-eslint"
5
6
  import angularFileNaming from "eslint-plugin-angular-file-naming"
6
- import rxjsAngular from "eslint-plugin-rxjs-angular"
7
+ import rxjsAngular from "eslint-plugin-rxjs-angular-x"
7
8
  import testingLibrary from "eslint-plugin-testing-library"
8
- import tseslint from "typescript-eslint"
9
9
 
10
10
  import { noAutofixPreferArrowFunctionsConfig, noRestrictedSyntax as noRestrictedSyntaxJS, preferArrowFunctionsConfig, preventAbbreviationsConfig as preventAbbreviationsConfigJS } from "./javascript.mjs"
11
11
  import { getModuleVersion, jestFilePatterns, jestNoRestrictedSyntax } from "./lib/utils.mjs"
@@ -14,7 +14,6 @@ import beslogicRXJS from "./rxjs.mjs"
14
14
  import beslogicTypeScript from "./typescript.mjs"
15
15
 
16
16
  const typescriptVersion = getModuleVersion("typescript", 4.7)
17
- const eslintVersion = getModuleVersion("eslint", 8.56)
18
17
 
19
18
  const typeDefinitionOverride = beslogicTypeScript.find(
20
19
  config => config.files?.includes("**/*.d.ts")
@@ -22,13 +21,6 @@ const typeDefinitionOverride = beslogicTypeScript.find(
22
21
 
23
22
  export const noRestrictedSyntax = [
24
23
  ...noRestrictedSyntaxJS,
25
- // TODO: Asked to be its own rule: https://github.com/angular-eslint/angular-eslint/issues/1002
26
- {
27
- "selector":
28
- "ClassDeclaration:has(Decorator :matches([name=\"Component\"], [name=\"Injectable\"], [name=\"Directive\"], [name=\"Pipe\"])) :matches(PropertyDefinition[key.name=\"intercept\"], PropertyDefinition[key.name=\"ngOnChanges\"], PropertyDefinition[key.name=\"ngOnInit\"], PropertyDefinition[key.name=\"ngDoCheck\"], PropertyDefinition[key.name=\"ngAfterContentInit\"], PropertyDefinition[key.name=\"ngAfterContentChecked\"], PropertyDefinition[key.name=\"ngAfterViewInit\"], PropertyDefinition[key.name=\"ngAfterViewChecked\"], PropertyDefinition[key.name=\"ngOnDestroy\"])",
29
- "message":
30
- "Angular hooks need to be functions defined on the prototype: https://github.com/angular/angular/issues/7270#issuecomment-201137617"
31
- },
32
24
  // TODO: Possibly implement that ourselves?
33
25
  // Upstream request: https://github.com/MelvinVermeer/eslint-plugin-no-relative-import-paths/issues/30
34
26
  {
@@ -67,52 +59,61 @@ preventAbbreviationsConfig.allowList.def = true
67
59
  const end2endPreventAbbreviationsConfig = { ...preventAbbreviationsConfig }
68
60
  end2endPreventAbbreviationsConfig.allowList.e = true
69
61
 
70
- export default tseslint.config(
62
+ export default defineConfig(
71
63
  beslogicRXJS,
72
64
  beslogicTypeScript,
73
- // For some reasons I'm unable to configure the parser.
74
- // The doc doesn't even mention needing to configure it, could be a v9 only support.
75
- eslintVersion >= 9
76
- ? {
77
- "files": ["**/*.html"],
78
- "extends": [...angular.configs.templateAll],
79
- "rules": {
80
- "@angular-eslint/template/click-events-have-key-events": "off",
81
- "@angular-eslint/template/conditional-complexity": [
82
- "error",
83
- // Same as ESLint sonarjs/cognitive-complexity
84
- { "maxComplexity": 20 }
85
- ],
86
- "@angular-eslint/template/cyclomatic-complexity": [
87
- "error",
88
- // Same as ESLint complexity
89
- { "maxComplexity": 20 }
90
- ],
91
- "@angular-eslint/template/eqeqeq": [
92
- "error",
93
- { "allowNullOrUndefined": true }
94
- ],
95
- "@angular-eslint/template/no-inline-styles": [
96
- "error",
97
- {
98
- "allowNgStyle": true,
99
- "allowBindToStyle": true
100
- }
101
- ],
102
- "@angular-eslint/template/attributes-order": "error",
103
- // Don't autofix as these should be handled manually, also configured in extra-strict preset
104
- "@angular-eslint/template/i18n": "off",
105
- // This constantly requires wrapping images in an additional div or knowing the exact display size.
106
- // Doesn't support relative sizing either, not sure if worth even trying to enforce.
107
- "@angular-eslint/template/prefer-ngsrc": "off",
108
- // TODO: Investigate the value of this rule.
109
- // It is new to me as well and I want to ensure I can isolate and understand breaking changes.
110
- // Maybe with NG17's new control flow syntax that eliminates the need for track-by directive?
111
- "@angular-eslint/template/use-track-by-function": "off"
112
- }
65
+ {
66
+ "name": "beslogic/angular/html",
67
+ "files": ["**/*.html"],
68
+ "extends": [...angular.configs.templateAll],
69
+ "rules": {
70
+ /*
71
+ * angular-eslint/template overrides (https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/README.md#rules)
72
+ */
73
+ "@angular-eslint/template/attributes-order": "error",
74
+ "@angular-eslint/template/click-events-have-key-events": "off",
75
+ "@angular-eslint/template/conditional-complexity": [
76
+ "error",
77
+ // Same as ESLint sonarjs/cognitive-complexity
78
+ { "maxComplexity": 20 }
79
+ ],
80
+ "@angular-eslint/template/cyclomatic-complexity": [
81
+ "error",
82
+ // Same as ESLint complexity
83
+ { "maxComplexity": 20 }
84
+ ],
85
+ "@angular-eslint/template/eqeqeq": [
86
+ "error",
87
+ { "allowNullOrUndefined": true }
88
+ ],
89
+ "@angular-eslint/template/no-inline-styles": [
90
+ "error",
91
+ {
92
+ "allowNgStyle": true,
93
+ "allowBindToStyle": true
94
+ }
95
+ ],
96
+ "@angular-eslint/template/no-interpolation-in-attributes": [
97
+ "error",
98
+ {
99
+ "allowSubstringInterpolation": true
100
+ }
101
+ ],
102
+
103
+ // Don't autofix as these should be handled manually, also configured in extra-strict preset
104
+ "@angular-eslint/template/i18n": "off",
105
+ // This constantly requires wrapping images in an additional div or knowing the exact display size.
106
+ // Doesn't support relative sizing either, not sure if worth even trying to enforce.
107
+ // v20.7 adds some suggestions to this rule
108
+ "@angular-eslint/template/prefer-ngsrc": "off",
109
+ // TODO: Investigate the value of this rule.
110
+ // It is new to me as well and I want to ensure I can isolate and understand breaking changes.
111
+ // Maybe with NG17's new control flow syntax that eliminates the need for track-by directive?
112
+ "@angular-eslint/template/use-track-by-function": "off"
113
113
  }
114
- : {},
114
+ },
115
115
  {
116
+ "name": "beslogic/angular/ts",
116
117
  "files": ["**/*.ts"],
117
118
  "extends": [...angular.configs.tsAll],
118
119
  "processor": angular.processInlineTemplates,
@@ -122,10 +123,6 @@ export default tseslint.config(
122
123
  },
123
124
  "languageOptions": {
124
125
  "parserOptions": {
125
- "project": [
126
- "tsconfig?(.*).json",
127
- "**/tsconfig?(.*).json" // For example: e2e/tsconfig.json
128
- ],
129
126
  // Needed specifically for @typescript-eslint/consistent-type-imports
130
127
  // https://typescript-eslint.io/rules/consistent-type-imports/#caveat-decorators--experimentaldecorators-true--emitdecoratormetadata-true
131
128
  "emitDecoratorMetadata": typescriptVersion >= 5
@@ -152,9 +149,8 @@ export default tseslint.config(
152
149
  ],
153
150
 
154
151
  /*
155
- * rxjs-angular rules
152
+ * rxjs-angular-x rules
156
153
  */
157
- "rxjs/no-finnish": "error",
158
154
  "rxjs-angular/prefer-async-pipe": "off",
159
155
  "rxjs-angular/prefer-composition": [
160
156
  "error",
@@ -177,7 +173,7 @@ export default tseslint.config(
177
173
  ],
178
174
 
179
175
  /*
180
- * Angular-eslint overrides (https://github.com/angular-eslint/angular-eslint/tree/master/packages/eslint-plugin/docs/rules)
176
+ * Angular-eslint overrides (https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/README.md#rules)
181
177
  */
182
178
  "@angular-eslint/component-class-suffix": [
183
179
  "error",
@@ -202,22 +198,15 @@ export default tseslint.config(
202
198
  "style": "camelCase"
203
199
  }
204
200
  ],
205
- // Deprecated in v18, removed in v19.
206
- // TODO: Adopt the inverse rule once it's been created. This is the recommendation for signals
207
- // See https://github.com/angular-eslint/angular-eslint/discussions/2303
208
- "@angular-eslint/no-host-metadata-property": "off",
209
201
  "@angular-eslint/prefer-on-push-component-change-detection": "off",
202
+ // Deprecated and to be removed (removed from "all" config in v21)
203
+ "@angular-eslint/no-conflicting-lifecycle": "off",
210
204
  // We need to disable the autofix because some of the "new" standalone components
211
205
  // would still be declared in their module. This breaks Angular and requires manual changes.
212
- "@angular-eslint/prefer-standalone-component": "off",
213
- // IDEM but updated rule that now works on more than components
214
206
  "@angular-eslint/prefer-standalone": "off",
215
- // Prefer Standalone still requires a bit of convincing,
207
+ // TODO: Prefer Standalone still requires a bit of convincing,
216
208
  // maybe with NG17's new control flow syntax that reduces imports in standalone components?
217
- // And not until this rule also applies to Pipes and Directives
218
- // https://github.com/angular-eslint/angular-eslint/pull/1627#pullrequestreview-1807581472
219
- "no-autofix/@angular-eslint/prefer-standalone-component": "off",
220
- // IDEM but updated rule that now works on more than components
209
+ // Note that in v20 this is no longer an autofix, but a suggestion
221
210
  "no-autofix/@angular-eslint/prefer-standalone": "off",
222
211
 
223
212
  /*
@@ -227,7 +216,7 @@ export default tseslint.config(
227
216
  "error",
228
217
  "interface"
229
218
  ],
230
- // TODO: https://dev.azure.com/Beslogic/ESLint-Config-Beslogic/_workitems/edit/16268
219
+ // TODO: https://dev.azure.com/Beslogic/NexusLab/_workitems/edit/16268
231
220
  "@typescript-eslint/member-ordering": "off",
232
221
  // Angular directives can lead to empty classes
233
222
  // Angular's withConfig pattern for @NgModule leads to only static method
@@ -236,9 +225,10 @@ export default tseslint.config(
236
225
  "error",
237
226
  { "allowWithDecorator": true }
238
227
  ],
239
- // Incompatible with Angular's dependecy injection
228
+ // Incompatible with Angular's dependency injection
229
+ // TODO: What about the new (non-decorator) dependency injection ?
240
230
  "@typescript-eslint/no-invalid-this": "off",
241
- // Redundant with Angular's dependecy injection
231
+ // Redundant with Angular's dependency injection
242
232
  "@typescript-eslint/parameter-properties": "off",
243
233
  "unicorn/no-keyword-prefix": [
244
234
  "error",
@@ -267,6 +257,7 @@ export default tseslint.config(
267
257
  }
268
258
  },
269
259
  {
260
+ "name": "beslogic/angular/js-assumed-node",
270
261
  "files": [
271
262
  "**/*.js",
272
263
  "**/*.[cm]js"
@@ -274,18 +265,20 @@ export default tseslint.config(
274
265
  "extends": [...beslogicNodeJS]
275
266
  },
276
267
  {
268
+ "name": "beslogic/angular/polyfills",
277
269
  "files": ["**/polyfills.ts"],
278
270
  "rules": {
279
271
  "simple-import-sort/imports": "off"
280
272
  }
281
273
  },
282
274
  {
275
+ "name": "beslogic/angular/arrow-function-lifecycle-methods",
283
276
  "files": [
284
277
  // See no-restricted-syntax
285
278
  // TODO: See if it's possible to implement myself (library updates or eslint-rule-composer)
286
279
  "**/*[.-]component.ts",
287
280
  "**/*[.-]directive.ts",
288
- "**/*[.-]interceptor.ts",
281
+ "**/*[.-]interceptor.ts", // @Injectable
289
282
  "**/*[.-]service.ts", // @Injectable
290
283
  "**/*[.-]pipes.ts"
291
284
  ],
@@ -313,6 +306,7 @@ export default tseslint.config(
313
306
  }
314
307
  },
315
308
  {
309
+ "name": "beslogic/angular/jest",
316
310
  "files": jestFilePatterns,
317
311
  "extends": [testingLibrary.configs["flat/angular"]],
318
312
  "rules": {
@@ -320,6 +314,7 @@ export default tseslint.config(
320
314
  }
321
315
  },
322
316
  {
317
+ "name": "beslogic/angular/e2e-abbreviations",
323
318
  "files": [
324
319
  "**/*.e2e-spec.ts",
325
320
  "**/*.d.ts"
@@ -334,6 +329,7 @@ export default tseslint.config(
334
329
  },
335
330
  {
336
331
  // Exceptions for Storybook
332
+ "name": "beslogic/angular/storybook",
337
333
  "files": [
338
334
  "**/*.stories.ts",
339
335
  "**/*.story.ts"
@@ -346,6 +342,7 @@ export default tseslint.config(
346
342
  }
347
343
  },
348
344
  {
345
+ "name": "beslogic/angular/filename-case",
349
346
  "files": [
350
347
  "**/*.[jt]s",
351
348
  "**/*.html"