eslint-config-beslogic 3.1.2 → 3.1.4
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 +1 -1
- package/CHANGELOG.md +26 -0
- package/README.md +1 -1
- package/TODO-SONARJS_CHECK_IF_DUPLICATED.json +0 -1
- package/extra-strict.js +13 -8
- package/javascript.js +1 -0
- package/package.json +6 -10
- package/tsconfig.4.3.json +3 -0
- package/tsconfig.5.0.json +3 -0
- package/tsconfig.json +3 -1
- package/typescript.js +8 -1
package/.dprint.jsonc
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
|
|
4
4
|
{
|
|
5
5
|
// https://dprint.dev/config/#extending-a-different-configuration-file
|
|
6
|
-
"extends": "https://raw.githubusercontent.com/BesLogic/shared-configs/main/dprint-json-like.json"
|
|
6
|
+
"extends": "https://raw.githubusercontent.com/BesLogic/shared-configs/main/dprint-json-like.json",
|
|
7
7
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.1.4
|
|
4
|
+
|
|
5
|
+
- Pinned `eslint-plugin-unicorn` to `>=49.0 && <57`
|
|
6
|
+
|
|
7
|
+
## 3.1.3
|
|
8
|
+
|
|
9
|
+
- Bumped `"@typescript-eslint` to `^8.15.0`
|
|
10
|
+
- Disabled `sonarjs/fixme-tag`
|
|
11
|
+
- Disabled `@typescript-eslint/no-unsafe-type-assertion` and `@typescript-eslint/related-getter-setter-pairs` in non-`extra-strict` presets.
|
|
12
|
+
- Added `"checkTypePredicates": true` to `@typescript-eslint/no-unnecessary-condition`
|
|
13
|
+
- Configured `@typescript-eslint/prefer-nullish-coalescing` as
|
|
14
|
+
<!-- markdownlint-disable-next-line MD031 -->
|
|
15
|
+
```js
|
|
16
|
+
[
|
|
17
|
+
"error",
|
|
18
|
+
{
|
|
19
|
+
// > If you're looking to enforce stricter conditional tests,
|
|
20
|
+
// > you should consider using the strict-boolean-expressions rule.
|
|
21
|
+
"ignoreConditionalTests": true,
|
|
22
|
+
"ignoreBooleanCoercion": true
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
```
|
|
26
|
+
|
|
3
27
|
## 3.1.2
|
|
4
28
|
|
|
5
29
|
- Removed `globalThis` from `no-restricted-globals` as the adoption is now much wider (no more IE11) and it conflicts with `unicorn/prefer-global-this`
|
|
@@ -44,6 +68,7 @@
|
|
|
44
68
|
}
|
|
45
69
|
```
|
|
46
70
|
|
|
71
|
+
```
|
|
47
72
|
`eslint-plugin-sonarjs@2` added a ton of rules, a lot of which duplicates base ESLint rules and other plugins we have. _**Please report those you find**_
|
|
48
73
|
|
|
49
74
|
### Changes
|
|
@@ -254,3 +279,4 @@
|
|
|
254
279
|
- Changed the maximum line length from `120` to `100`
|
|
255
280
|
- Split language-specific `editor.defaultFormatter` to work around
|
|
256
281
|
<https://github.com/microsoft/vscode/issues/168411>
|
|
282
|
+
```
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Depending on your needs, you will need to also install other peer dependencies f
|
|
|
9
9
|
In your `.eslintrc` file, add `"extends": "beslogic/<preset>"` (see all available presets below)
|
|
10
10
|
|
|
11
11
|
For stylistic rules, it is highly recommended to use a dedicated formatter over ESLint. Read more here: <https://typescript-eslint.io/docs/linting/troubleshooting/formatting/>\
|
|
12
|
-
|
|
12
|
+
We assume [dprint](https://dprint.dev/) and don't enable any rules it covers by default. If you're not using a formatter, a [stylistic.mjs](#beslogicstylistic) configuration is offered below.
|
|
13
13
|
|
|
14
14
|
## Parallel configurations
|
|
15
15
|
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"sonarjs/encryption-secure-mode": "error",
|
|
29
29
|
"sonarjs/file-permissions": "error",
|
|
30
30
|
"sonarjs/file-uploads": "error",
|
|
31
|
-
"sonarjs/fixme-tag": "error",
|
|
32
31
|
"sonarjs/for-loop-increment-sign": "error",
|
|
33
32
|
"sonarjs/frame-ancestors": "error",
|
|
34
33
|
"sonarjs/function-inside-loop": "error",
|
package/extra-strict.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
const { resolveModuleLocation, jestFilePatterns } = require("./lib/utils")
|
|
2
2
|
|
|
3
|
-
// TODO: ADD no-unsafe-type-assertion ONCE IT'S PUBLISHED ! (and the message I used to include)
|
|
4
|
-
// (remove from non-strict, add back here, then re-disable for jest at the bottom of the file)
|
|
5
|
-
// https://github.com/typescript-eslint/typescript-eslint/pull/10051
|
|
6
|
-
// https://github.com/typescript-eslint/typescript-eslint/issues/7173
|
|
7
|
-
|
|
8
3
|
// These extra strict configs are not only for Angular. User may be using a different framework
|
|
9
4
|
const hasAngularEslintTemplate = !!resolveModuleLocation("@angular-eslint/eslint-plugin-template")
|
|
10
5
|
|
|
@@ -33,8 +28,8 @@ module.exports = {
|
|
|
33
28
|
// https://typescript-eslint.io/rules/no-invalid-this/
|
|
34
29
|
"@typescript-eslint/no-invalid-this": "off",
|
|
35
30
|
|
|
36
|
-
//
|
|
37
|
-
//
|
|
31
|
+
// consistent-type-assertions + no-unsafe-type-assertion replaced total-functions/no-unsafe-type-assertion
|
|
32
|
+
// TODO: Ask to include my examples of how to fix, or eventually highjack rules to add more descriptions
|
|
38
33
|
//
|
|
39
34
|
// It takes an advanced TypeScript user to fully make sense of this rule
|
|
40
35
|
/**
|
|
@@ -60,7 +55,9 @@ module.exports = {
|
|
|
60
55
|
"error",
|
|
61
56
|
{ "assertionStyle": "as", "objectLiteralTypeAssertions": "allow-as-parameter" }
|
|
62
57
|
],
|
|
58
|
+
"@typescript-eslint/no-unsafe-type-assertion": "error",
|
|
63
59
|
|
|
60
|
+
"@typescript-eslint/related-getter-setter-pairs": "error",
|
|
64
61
|
"@typescript-eslint/restrict-template-expressions": [
|
|
65
62
|
"error",
|
|
66
63
|
{
|
|
@@ -85,7 +82,15 @@ module.exports = {
|
|
|
85
82
|
"error",
|
|
86
83
|
{ "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": false }
|
|
87
84
|
],
|
|
88
|
-
"@typescript-eslint/prefer-nullish-coalescing":
|
|
85
|
+
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
86
|
+
"error",
|
|
87
|
+
{
|
|
88
|
+
// > If you're looking to enforce stricter conditional tests,
|
|
89
|
+
// > you should consider using the strict-boolean-expressions rule.
|
|
90
|
+
"ignoreConditionalTests": true,
|
|
91
|
+
"ignoreBooleanCoercion": true
|
|
92
|
+
}
|
|
93
|
+
],
|
|
89
94
|
// We accept nullish as falsy
|
|
90
95
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
91
96
|
|
package/javascript.js
CHANGED
|
@@ -329,6 +329,7 @@ module.exports = {
|
|
|
329
329
|
* eslint-plugin-sonarjs@2 added rules that duplicate base ESLint rules or specific plugins we prefer
|
|
330
330
|
*/
|
|
331
331
|
// Duplicates no-warning-comments
|
|
332
|
+
"sonarjs/fixme-tag": "off",
|
|
332
333
|
"sonarjs/todo-tag": "off",
|
|
333
334
|
// Duplicates unicorn/prefer-string-starts-ends-with
|
|
334
335
|
"sonarjs/prefer-string-starts-ends-with": "off",
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-beslogic",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
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
8
|
"eslint": "set TIMING=1 && eslint ./ --ignore-path .gitignore",
|
|
9
9
|
"lint": "dprint check && npm run eslint",
|
|
10
|
-
"lint:fix": "
|
|
10
|
+
"lint:fix": "npm run eslint -- --fix && dprint fmt",
|
|
11
11
|
"upgrade": "npx npm-check-updates -u & npm i",
|
|
12
12
|
"yalc": "yalc publish",
|
|
13
13
|
"prepack": "type .gitignore* > .npmignore",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.1",
|
|
46
46
|
"@stylistic/eslint-plugin": "^2.8.0",
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
48
|
-
"@typescript-eslint/parser": "^8.
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
|
48
|
+
"@typescript-eslint/parser": "^8.15.0",
|
|
49
49
|
"@types/eslint": "^8.56",
|
|
50
50
|
"confusing-browser-globals": "^1.0",
|
|
51
51
|
"dprint": "^0.40.2",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"eslint-plugin-simple-import-sort": ">=12.0",
|
|
65
65
|
"eslint-plugin-sonarjs": "2.0.4",
|
|
66
66
|
"eslint-plugin-testing-library": "^6.0",
|
|
67
|
-
"eslint-plugin-unicorn": ">=49.0"
|
|
67
|
+
"eslint-plugin-unicorn": ">=49.0 && <57"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"@angular-eslint/eslint-plugin": ">=16.2",
|
|
@@ -82,15 +82,11 @@
|
|
|
82
82
|
"eslint-plugin-rxjs-angular": "github:BesLogic/eslint-plugin-rxjs-angular#dist",
|
|
83
83
|
"eslint-plugin-storybook": "^0.6.10"
|
|
84
84
|
},
|
|
85
|
-
"//
|
|
85
|
+
"// jest": "Don't install it, so that we test failure to specify jest version",
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@angular-eslint/eslint-plugin": ">=16.2",
|
|
88
|
-
"@angular-eslint/eslint-plugin-template": ">=16.2",
|
|
89
|
-
"@angular-eslint/template-parser": ">=16.2",
|
|
90
87
|
"@angular/core": ">=16.2",
|
|
91
88
|
"@types/node": "^18.0",
|
|
92
89
|
"eslint-plugin-eslint-plugin": "^6.0",
|
|
93
|
-
"eslint-plugin-storybook": "^0.6.10",
|
|
94
90
|
"react": "^18.3.1",
|
|
95
91
|
"yalc": "^1.0.0-pre.53"
|
|
96
92
|
}
|
package/tsconfig.4.3.json
CHANGED
package/tsconfig.5.0.json
CHANGED
package/tsconfig.json
CHANGED
package/typescript.js
CHANGED
|
@@ -257,6 +257,8 @@ module.exports = {
|
|
|
257
257
|
],
|
|
258
258
|
// Too many false-positives in TypeScript code
|
|
259
259
|
"autofix/no-unused-vars": "off",
|
|
260
|
+
// Leave to extra-strict configs
|
|
261
|
+
"@typescript-eslint/no-unsafe-type-assertion": "off",
|
|
260
262
|
"@typescript-eslint/no-unused-vars": noUnusedVariablesConfig,
|
|
261
263
|
"@typescript-eslint/no-use-before-define": [
|
|
262
264
|
"error",
|
|
@@ -303,6 +305,8 @@ module.exports = {
|
|
|
303
305
|
"checkArrowFunctions": false
|
|
304
306
|
}
|
|
305
307
|
],
|
|
308
|
+
// Leave to extra-strict configs
|
|
309
|
+
"@typescript-eslint/related-getter-setter-pairs": "off",
|
|
306
310
|
"@typescript-eslint/require-array-sort-compare": [
|
|
307
311
|
"error",
|
|
308
312
|
{
|
|
@@ -352,7 +356,10 @@ module.exports = {
|
|
|
352
356
|
// null/undefined checks. So only set it in non-strict preset.
|
|
353
357
|
"@typescript-eslint/no-unnecessary-condition": [
|
|
354
358
|
"error",
|
|
355
|
-
{
|
|
359
|
+
{
|
|
360
|
+
"allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": true,
|
|
361
|
+
"checkTypePredicates": true
|
|
362
|
+
}
|
|
356
363
|
],
|
|
357
364
|
// IDEM, but fully useless w/o strictNullChecks
|
|
358
365
|
"@typescript-eslint/prefer-nullish-coalescing": "off",
|