eslint-config-beslogic 3.2.2 → 3.3.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.3.1
4
+
5
+ (backport of 4.3.1)
6
+
7
+ - 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
+ - Allowed `0n` as a magic value by default
9
+
10
+ ## 3.3.0
11
+
12
+ (backport of 4.3.0)
13
+
14
+ - Correctly also disable `compilerOptions.emitDecoratorMetadata` when disabling `compilerOptions.experimentalDecorators` out of the box
15
+ - Added instructions to explicitely enable both on Angular projects using experimental decorators
16
+ - Added a `tsconfig.5.6.json` TSConfig preset with `noUncheckedSideEffectImports` enabled
17
+ - Enabled `compilerOptions.resolveJsonModule` by default
18
+ - Enabled `compilerOptions.checkJS` by default
19
+ - Relaxed `prefer-arrow/prefer-arrow-functions` for `**/*[.-]service.ts` files as we expected `@Injectable` to have lifecycle methods
20
+ - Disabled `@typescript-eslint/prefer-for-of` and `sonarjs/prefer-for-of` in favor of `unicorn/no-for-loop`
21
+ - Allowed `i++` in "loop afterthrought" (`for (i = 0; i < l; i++)`) for rule `autofix/no-plusplus`
22
+ - Set `@typescript-eslint/switch-exhaustiveness-check`'s `considerDefaultExhaustiveForUnions` to `false` in non-extra-strict preset
23
+ - Disabled `unicorn/no-useless-switch-case` in extra-strict preset as it and conflicts with `considerDefaultExhaustiveForUnions`
24
+ - Bumped `@stylistic/eslint-plugin` to `^2.12.0` as it fixed `jsx-wrap-multilines` breaking in the presence of comments
25
+ - Bumped `dprint` to `^0.46` to ensure .gitignore support
26
+
3
27
  ## 3.2.2
4
28
 
5
29
  - Disabled `unicorn/no-useless-switch-case` in extra-strict preset as it conflicts with `considerDefaultExhaustiveForUnions`
package/README.md CHANGED
@@ -23,6 +23,12 @@ Read the [`package.json`](https://github.com/BesLogic/shared-configs/blob/main/R
23
23
 
24
24
  Extend the following in your base `tsconfig.json` (follow link for more details):
25
25
 
26
+ [`typescript@>=5.6`](https://socket.dev/npm/package/eslint-config-beslogic/files/latest/tsconfig.5.6.json):
27
+
28
+ ```jsonc
29
+ "extends": ["eslint-config-beslogic/tsconfig.5.6.json"],
30
+ ```
31
+
26
32
  [`typescript@>=5.0`](https://socket.dev/npm/package/eslint-config-beslogic/files/latest/tsconfig.5.0.json):
27
33
 
28
34
  ```jsonc
@@ -37,6 +43,15 @@ Extend the following in your base `tsconfig.json` (follow link for more details)
37
43
 
38
44
  "No Unchecked Indexed Access" makes index accesses even stricter. You may not want it in your project or in your tests. You can disable it with `"compilerOptions": { "noUncheckedIndexedAccess": false }`.
39
45
 
46
+ If using experimental decorators (likely for an Angular project), you still need to set
47
+
48
+ ```jsonc
49
+ "compilerOptions": {
50
+ "emitDecoratorMetadata": true,
51
+ "experimentalDecorators": true,
52
+ }
53
+ ```
54
+
40
55
  If deploying / bundling with an Angular npm package, also set `angularCompilerOptions": { "strictMetadataEmit": true }`.
41
56
 
42
57
  ### `.vscode/settings.json` and `.vscode/extensions.json`
@@ -136,7 +136,6 @@
136
136
  "sonarjs/os-command": "error",
137
137
  "sonarjs/post-message": "error",
138
138
  "sonarjs/prefer-default-last": "error",
139
- "sonarjs/prefer-for-of": "error",
140
139
  "sonarjs/prefer-function-type": "error",
141
140
  "sonarjs/prefer-namespace-keyword": "error",
142
141
  "sonarjs/prefer-promise-shorthand": "error",
package/angular.js CHANGED
@@ -217,6 +217,10 @@ module.exports = {
217
217
  "style": "camelCase"
218
218
  }
219
219
  ],
220
+ // Deprecated in v18, removed in v19.
221
+ // TODO: Adopt inverse rule once it's been created. This is the recommendation for signals
222
+ // See https://github.com/angular-eslint/angular-eslint/discussions/2303
223
+ "@angular-eslint/no-host-metadata-property": "off",
220
224
  "@angular-eslint/prefer-on-push-component-change-detection": "off",
221
225
  // We need to disable the autofix because some of the "new" standalone components
222
226
  // would still be declared in their module. This breaks Angular and requires manual changes.
@@ -296,7 +300,7 @@ module.exports = {
296
300
  "*[.-]component.ts",
297
301
  "*[.-]directive.ts",
298
302
  "*[.-]interceptor.ts",
299
- "**/*[.-]service.ts", // @Injectable
303
+ "*[.-]service.ts", // @Injectable
300
304
  "*[.-]pipes.ts"
301
305
  ],
302
306
  "rules": {
package/javascript.js CHANGED
@@ -76,6 +76,10 @@ module.exports = {
76
76
  */
77
77
  "rules": {
78
78
  "autofix/no-caller": "error",
79
+ "autofix/no-plusplus": [
80
+ "error",
81
+ { "allowForLoopAfterthoughts": true }
82
+ ],
79
83
  "autofix/no-proto": "error",
80
84
  "autofix/no-prototype-builtins": "error",
81
85
  "autofix/no-throw-literal": "error",
@@ -333,6 +337,8 @@ module.exports = {
333
337
  "sonarjs/todo-tag": "off",
334
338
  // Duplicates unicorn/prefer-string-starts-ends-with
335
339
  "sonarjs/prefer-string-starts-ends-with": "off",
340
+ // Duplicates unicorn/no-for-loop and typescript-eslint/prefer-for-of
341
+ "sonarjs/prefer-for-of": "off",
336
342
  // Duplicates no-nested-ternary and unicorn/no-nested-ternary
337
343
  "sonarjs/no-nested-conditional": "off",
338
344
 
@@ -571,7 +577,7 @@ module.exports = {
571
577
  // Packages.
572
578
  // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
573
579
  ["^@?\\w"],
574
- // Absolute imports and other imports such as Vue-style `@/foo`.
580
+ // Absolute imports and other imports such as Vue or Next style `@/foo`.
575
581
  // Anything not matched in another group.
576
582
  ["^"],
577
583
  // Relative imports.
@@ -890,6 +896,8 @@ module.exports = {
890
896
  // "detectObjects": true,
891
897
  "enforceConst": true,
892
898
  "ignore": [
899
+ // Used in Falsy type definition
900
+ "0n",
893
901
  // Access first element
894
902
  0,
895
903
  // Off by one indexes & comparisons
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-beslogic",
3
- "version": "3.2.2",
3
+ "version": "3.3.1",
4
4
  "description": "ESLint rules, plugins and configs used at Beslogic",
5
5
  "main": "index.js",
6
6
  "// dependencies": "Run for ourselves when we install dependencies w/o running npm i afterward",
@@ -43,12 +43,12 @@
43
43
  "// eslint-plugin-sonarjs": "Exact version pin. Check for new presets and typescript-eslint@8 support as we",
44
44
  "dependencies": {
45
45
  "@eslint-community/eslint-plugin-eslint-comments": "^4.1",
46
- "@stylistic/eslint-plugin": "^2.8.0",
46
+ "@stylistic/eslint-plugin": "^2.12.0",
47
47
  "@typescript-eslint/eslint-plugin": "^8.15.0",
48
48
  "@typescript-eslint/parser": "^8.15.0",
49
49
  "@types/eslint": "^8.56",
50
50
  "confusing-browser-globals": "^1.0",
51
- "dprint": "^0.40.2",
51
+ "dprint": "^0.46.0",
52
52
  "eslint": "^8.57",
53
53
  "eslint-import-resolver-typescript": "^3.2.6",
54
54
  "eslint-plugin-autofix": "^1.1 || ^2.0",
package/tsconfig.4.3.json CHANGED
@@ -4,8 +4,10 @@
4
4
  {
5
5
  "compilerOptions": {
6
6
  "strict": true,
7
+ "checkJs": true,
7
8
  "newLine": "LF", // Now default in TypeScript 5.0
8
9
  "forceConsistentCasingInFileNames": true, // Now default in TypeScript 5.0
10
+ "resolveJsonModule": true,
9
11
  "noFallthroughCasesInSwitch": true,
10
12
  "noImplicitOverride": true,
11
13
  "noImplicitReturns": true,
package/tsconfig.5.0.json CHANGED
@@ -5,10 +5,14 @@
5
5
  "extends": "./tsconfig.4.3.json",
6
6
  "compilerOptions": {
7
7
  "verbatimModuleSyntax": true,
8
- // Since this is no longer needed for Angular with TypeScript 5, let's
8
+ // Since these are no longer needed for most projects with TypeScript 5, let's
9
9
  // disable it so @typescript-eslint/consistent-type-imports doesn't turn
10
10
  // itself off in files using decorators.
11
+ // Likely still needed in Angular, if you wanna try without,
12
+ // see https://angular.dev/reference/migrations/inject-function for migrating @Inject
13
+ //
11
14
  // https://typescript-eslint.io/rules/consistent-type-imports/#caveat-decorators--experimentaldecorators-true--emitdecoratormetadata-true
15
+ "emitDecoratorMetadata": false,
12
16
  "experimentalDecorators": false
13
17
  }
14
18
  }
@@ -0,0 +1,15 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright 2025 Beslogic Inc.
3
+
4
+ {
5
+ "extends": "./tsconfig.5.0.json",
6
+ "compilerOptions": {
7
+ "noUncheckedSideEffectImports": true
8
+ // Likely still needed in Angular, if you wanna try without,
9
+ // see https://angular.dev/reference/migrations/inject-function for migrating @Inject
10
+ //
11
+ // https://typescript-eslint.io/rules/consistent-type-imports/#caveat-decorators--experimentaldecorators-true--emitdecoratormetadata-true
12
+ // "emitDecoratorMetadata": true,
13
+ // "experimentalDecorators": true,
14
+ }
15
+ }
package/tsconfig.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
- "extends": "./tsconfig.4.3.json",
2
+ "extends": "./tsconfig.5.6.json",
3
3
  "compilerOptions": {
4
- "moduleResolution": "Node16",
5
- "module": "Node16",
4
+ "module": "nodenext", // Set to node18 once we update to typescript 5.8
6
5
  "allowSyntheticDefaultImports": true,
7
6
  "noUncheckedIndexedAccess": false,
8
7
  "noEmit": true,
9
8
  "jsx": "react",
10
9
  "allowJs": true,
11
- "checkJs": true,
12
10
  "noImplicitAny": false,
11
+ // For Angular tests
12
+ "verbatimModuleSyntax": false,
13
+ "emitDecoratorMetadata": true,
14
+ "experimentalDecorators": true,
13
15
  },
14
16
  }
package/typescript.js CHANGED
@@ -299,6 +299,11 @@ module.exports = {
299
299
  ],
300
300
  "@typescript-eslint/prefer-enum-initializers": "off",
301
301
 
302
+ // Very similar to `unicorn/no-for-loop` but doesn't have autofixes.
303
+ // TODO: If autofixes or suggestion is added, prefer over unicorn's
304
+ // https://github.com/typescript-eslint/typescript-eslint/issues/11336
305
+ "@typescript-eslint/prefer-for-of": "off",
306
+
302
307
  // TODO: Would accept this if it had autofixes, otherwise this is too tedious to use. Check again later
303
308
  "@typescript-eslint/prefer-readonly-parameter-types": "off",
304
309
  "@typescript-eslint/prefer-string-starts-ends-with": [