eslint-config-beslogic 2.4.5 → 2.4.6

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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.6
4
+
5
+ - Replaced `@typescript-eslint/*` with `typescript-eslint`
6
+ - Loosened rules requirering `strictNullChecks` if `eslint-plugin-total-functions` isn't also installed
7
+
3
8
  ## 2.4.5
4
9
 
5
10
  - Include documentation about usage with `.pre-commit-config.yaml`/`pre-commit.ci`
@@ -15,6 +20,7 @@
15
20
  - Moved `eslint-plugin-testing-library` to `dependencies`
16
21
  - Bumped `eslint-plugin-unused-imports` to `^3.2.0` to fix error with `@typescript-eslint@7.8`
17
22
  - Don't check for camelcase properties in eslint config files
23
+ - Turn on `prefer-arrow/prefer-arrow-functions` autofixing for `singleReturnOnly`
18
24
 
19
25
  ## 2.3.2
20
26
 
package/angular.js CHANGED
@@ -77,7 +77,9 @@ module.exports = {
77
77
  "overrides": [
78
78
  {
79
79
  "files": ["*.html"],
80
- "plugins": hasNoAutofix ? ["no-autofix"] : [],
80
+ "plugins": hasNoAutofix
81
+ ? ["no-autofix"]
82
+ : [],
81
83
  "extends": ["plugin:@angular-eslint/template/all"],
82
84
  "rules": {
83
85
  "@angular-eslint/template/click-events-have-key-events": "off",
package/javascript.js CHANGED
@@ -44,7 +44,9 @@ const noRestrictedSyntax = [
44
44
  module.exports = {
45
45
  "plugins": [
46
46
  "extra-rules",
47
- ...hasNoAutofix ? ["no-autofix"] : [],
47
+ ...hasNoAutofix
48
+ ? ["no-autofix"]
49
+ : [],
48
50
  "prefer-arrow",
49
51
  "simple-import-sort",
50
52
  "no-relative-import-paths",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "eslint-config-beslogic",
3
- "version": "2.4.5",
3
+ "version": "2.4.6",
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",
7
7
  "scripts": {
8
- "eslint": "eslint ./ --ignore-path .gitignore",
8
+ "eslint": "set TIMING=1 && eslint ./ --ignore-path .gitignore",
9
9
  "lint": "node ./node_modules/dprint/bin check && npm run eslint",
10
10
  "lint:fix": "node ./node_modules/dprint/bin fmt && npm run eslint -- --fix",
11
11
  "upgrade": "npx npm-check-updates -u & npm i",
@@ -42,7 +42,6 @@
42
42
  "dependencies": {
43
43
  "@babel/eslint-parser": "^7.20.12",
44
44
  "@eslint-community/eslint-plugin-eslint-comments": "^4.1",
45
- "@typescript-eslint/eslint-plugin": "^7.4",
46
45
  "confusing-browser-globals": "^1.0",
47
46
  "dprint": "^0.40.2",
48
47
  "eslint": "^8.56",
@@ -61,7 +60,8 @@
61
60
  "eslint-plugin-sonarjs": "^1.0",
62
61
  "eslint-plugin-testing-library": "^6.0",
63
62
  "eslint-plugin-unicorn": ">=49.0",
64
- "eslint-plugin-unused-imports": "^3.2"
63
+ "eslint-plugin-unused-imports": "^3.2",
64
+ "typescript-eslint": "^7.4"
65
65
  },
66
66
  "// eslint-plugin-total-functions": "Supported version is dictated by TypeScript and ESLint",
67
67
  "// (cont)": "Also made optional because of extra strictness",
package/typescript.js CHANGED
@@ -302,10 +302,6 @@ module.exports = {
302
302
  }
303
303
  ],
304
304
  "@typescript-eslint/no-type-alias": "off",
305
- "@typescript-eslint/no-unnecessary-condition": [
306
- "error",
307
- { "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": true }
308
- ],
309
305
  // Note: These 2 drown TS2304 and actually make the errors harder to understand.
310
306
  // See: https://github.com/typescript-eslint/typescript-eslint/issues/2665
311
307
  // There's nothing we can do until a pedantic any check in TypeScript is added
@@ -313,8 +309,9 @@ module.exports = {
313
309
  // Which is likely never gonna happen: https://github.com/microsoft/TypeScript/issues/24737
314
310
  // We still want to be aware that we are using an any type and should be cautious
315
311
  //
316
- // TODO: Turn back no-unsafe-assignment to error after creating and publishing type extensions that replaces any
317
- // with unknown in standard libs. See Empassion for example *.d.ts files
312
+ // TODO: Turn back no-unsafe-assignment to error after creating and publishing type
313
+ // extensions that replaces any with unknown in standard libs.
314
+ // See Empassion for example *.d.ts files
318
315
  // Refs: https://github.com/Microsoft/TypeScript/issues/26188
319
316
  // and https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
320
317
  "@typescript-eslint/no-unsafe-assignment": "warn",
@@ -456,11 +453,6 @@ module.exports = {
456
453
  "int32Hint": true
457
454
  }
458
455
  ],
459
- // We accept nullish as falsy
460
- "@typescript-eslint/strict-boolean-expressions": [
461
- "off",
462
- { "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": true }
463
- ],
464
456
  "@typescript-eslint/switch-exhaustiveness-check": [
465
457
  "error",
466
458
  {
@@ -476,7 +468,24 @@ module.exports = {
476
468
  "@typescript-eslint/unified-signatures": [
477
469
  "error",
478
470
  { "ignoreDifferentlyNamedParameters": true }
479
- ]
471
+ ],
472
+
473
+ /*
474
+ * @typescript-eslint rules that require strictNullChecks
475
+ * Similar to eslint-plugin-total-functions, these requires stricter tsconfig or fails.
476
+ */
477
+ // Setting allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing makes this rule useless on
478
+ // null/undefined checks. So only set it if we don't already enforce stricter TS configs.
479
+ "@typescript-eslint/no-unnecessary-condition": [
480
+ "error",
481
+ { "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": !hasTotalFunctions }
482
+ ],
483
+ // IDEM, but fully useless w/o strictNullChecks
484
+ "@typescript-eslint/prefer-nullish-coalescing": hasTotalFunctions
485
+ ? "error"
486
+ : "off",
487
+ // We accept nullish as falsy
488
+ "@typescript-eslint/strict-boolean-expressions": "off"
480
489
  }
481
490
  },
482
491
  {