eslint-config-beslogic 2.4.5 → 2.4.7
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 +10 -0
- package/angular.js +3 -1
- package/javascript.js +3 -7
- package/package.json +4 -4
- package/typescript.js +27 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.4.7
|
|
4
|
+
|
|
5
|
+
- No longer recommending to explicitely annotate void returning awaitable arrow functions as `(param): void => { statement }` in JavaScript.
|
|
6
|
+
|
|
7
|
+
## 2.4.6
|
|
8
|
+
|
|
9
|
+
- Replaced `@typescript-eslint/*` with `typescript-eslint`
|
|
10
|
+
- Loosened rules requirering `strictNullChecks` if `eslint-plugin-total-functions` isn't also installed
|
|
11
|
+
|
|
3
12
|
## 2.4.5
|
|
4
13
|
|
|
5
14
|
- Include documentation about usage with `.pre-commit-config.yaml`/`pre-commit.ci`
|
|
@@ -15,6 +24,7 @@
|
|
|
15
24
|
- Moved `eslint-plugin-testing-library` to `dependencies`
|
|
16
25
|
- Bumped `eslint-plugin-unused-imports` to `^3.2.0` to fix error with `@typescript-eslint@7.8`
|
|
17
26
|
- Don't check for camelcase properties in eslint config files
|
|
27
|
+
- Turn on `prefer-arrow/prefer-arrow-functions` autofixing for `singleReturnOnly`
|
|
18
28
|
|
|
19
29
|
## 2.3.2
|
|
20
30
|
|
package/angular.js
CHANGED
|
@@ -77,7 +77,9 @@ module.exports = {
|
|
|
77
77
|
"overrides": [
|
|
78
78
|
{
|
|
79
79
|
"files": ["*.html"],
|
|
80
|
-
"plugins": hasNoAutofix
|
|
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
|
@@ -31,12 +31,6 @@ const noRestrictedSyntax = [
|
|
|
31
31
|
"message":
|
|
32
32
|
"Prefer `Promise.resolve().then()` instead of `setTimeout` without a specified delay. " +
|
|
33
33
|
"See: https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#reasons_for_delays_longer_than_specified and https://angular.io/guide/change-detection-zone-pollution"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"selector":
|
|
37
|
-
"ArrowFunctionExpression[body.body.length=1][body.body.0.type=\"ExpressionStatement\"]:not([returnType.typeAnnotation.type=\"TSVoidKeyword\"])",
|
|
38
|
-
"message": "Consider removing braces around the arrow function's body. " +
|
|
39
|
-
"If it really needs to return `void` you can mark its return type explicitely with `(param): void => { statement }` to disable this warning."
|
|
40
34
|
}
|
|
41
35
|
]
|
|
42
36
|
|
|
@@ -44,7 +38,9 @@ const noRestrictedSyntax = [
|
|
|
44
38
|
module.exports = {
|
|
45
39
|
"plugins": [
|
|
46
40
|
"extra-rules",
|
|
47
|
-
...hasNoAutofix
|
|
41
|
+
...hasNoAutofix
|
|
42
|
+
? ["no-autofix"]
|
|
43
|
+
: [],
|
|
48
44
|
"prefer-arrow",
|
|
49
45
|
"simple-import-sort",
|
|
50
46
|
"no-relative-import-paths",
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-beslogic",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.7",
|
|
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
|
@@ -12,6 +12,12 @@ const hasTotalFunctions = !!resolveModuleLocation("eslint-plugin-total-functions
|
|
|
12
12
|
const commaDangleDefault = "always-multiline"
|
|
13
13
|
const noRestrictedSyntax = [
|
|
14
14
|
...javascriptConfig.rules?.["no-restricted-syntax"] ?? {},
|
|
15
|
+
{
|
|
16
|
+
"selector":
|
|
17
|
+
"ArrowFunctionExpression[body.body.length=1][body.body.0.type=\"ExpressionStatement\"]:not([returnType.typeAnnotation.type=\"TSVoidKeyword\"])",
|
|
18
|
+
"message": "Consider removing braces around the arrow function's body. " +
|
|
19
|
+
"If it really needs to return `void` you can mark its return type explicitely with `(param): void => { statement }` to disable this warning."
|
|
20
|
+
},
|
|
15
21
|
// @typescript-eslint won't make this a rule
|
|
16
22
|
// https://github.com/typescript-eslint/typescript-eslint/issues/4247
|
|
17
23
|
{
|
|
@@ -302,10 +308,6 @@ module.exports = {
|
|
|
302
308
|
}
|
|
303
309
|
],
|
|
304
310
|
"@typescript-eslint/no-type-alias": "off",
|
|
305
|
-
"@typescript-eslint/no-unnecessary-condition": [
|
|
306
|
-
"error",
|
|
307
|
-
{ "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": true }
|
|
308
|
-
],
|
|
309
311
|
// Note: These 2 drown TS2304 and actually make the errors harder to understand.
|
|
310
312
|
// See: https://github.com/typescript-eslint/typescript-eslint/issues/2665
|
|
311
313
|
// There's nothing we can do until a pedantic any check in TypeScript is added
|
|
@@ -313,8 +315,9 @@ module.exports = {
|
|
|
313
315
|
// Which is likely never gonna happen: https://github.com/microsoft/TypeScript/issues/24737
|
|
314
316
|
// We still want to be aware that we are using an any type and should be cautious
|
|
315
317
|
//
|
|
316
|
-
// TODO: Turn back no-unsafe-assignment to error after creating and publishing type
|
|
317
|
-
// with unknown in standard libs.
|
|
318
|
+
// TODO: Turn back no-unsafe-assignment to error after creating and publishing type
|
|
319
|
+
// extensions that replaces any with unknown in standard libs.
|
|
320
|
+
// See Empassion for example *.d.ts files
|
|
318
321
|
// Refs: https://github.com/Microsoft/TypeScript/issues/26188
|
|
319
322
|
// and https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
|
|
320
323
|
"@typescript-eslint/no-unsafe-assignment": "warn",
|
|
@@ -456,11 +459,6 @@ module.exports = {
|
|
|
456
459
|
"int32Hint": true
|
|
457
460
|
}
|
|
458
461
|
],
|
|
459
|
-
// We accept nullish as falsy
|
|
460
|
-
"@typescript-eslint/strict-boolean-expressions": [
|
|
461
|
-
"off",
|
|
462
|
-
{ "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": true }
|
|
463
|
-
],
|
|
464
462
|
"@typescript-eslint/switch-exhaustiveness-check": [
|
|
465
463
|
"error",
|
|
466
464
|
{
|
|
@@ -476,7 +474,24 @@ module.exports = {
|
|
|
476
474
|
"@typescript-eslint/unified-signatures": [
|
|
477
475
|
"error",
|
|
478
476
|
{ "ignoreDifferentlyNamedParameters": true }
|
|
479
|
-
]
|
|
477
|
+
],
|
|
478
|
+
|
|
479
|
+
/*
|
|
480
|
+
* @typescript-eslint rules that require strictNullChecks
|
|
481
|
+
* Similar to eslint-plugin-total-functions, these requires stricter tsconfig or fails.
|
|
482
|
+
*/
|
|
483
|
+
// Setting allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing makes this rule useless on
|
|
484
|
+
// null/undefined checks. So only set it if we don't already enforce stricter TS configs.
|
|
485
|
+
"@typescript-eslint/no-unnecessary-condition": [
|
|
486
|
+
"error",
|
|
487
|
+
{ "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": !hasTotalFunctions }
|
|
488
|
+
],
|
|
489
|
+
// IDEM, but fully useless w/o strictNullChecks
|
|
490
|
+
"@typescript-eslint/prefer-nullish-coalescing": hasTotalFunctions
|
|
491
|
+
? "error"
|
|
492
|
+
: "off",
|
|
493
|
+
// We accept nullish as falsy
|
|
494
|
+
"@typescript-eslint/strict-boolean-expressions": "off"
|
|
480
495
|
}
|
|
481
496
|
},
|
|
482
497
|
{
|