eslint-plugin-remeda 1.3.1 → 1.5.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/README.md +30 -20
- package/dist/index.cjs +99 -88
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +48 -27
- package/docs/rules/collection-method-value.md +5 -1
- package/docs/rules/collection-return.md +5 -1
- package/docs/rules/prefer-constant.md +9 -1
- package/docs/rules/prefer-do-nothing.md +5 -1
- package/docs/rules/prefer-filter.md +9 -1
- package/docs/rules/prefer-find.md +5 -1
- package/docs/rules/prefer-flat-map.md +5 -1
- package/docs/rules/prefer-is-empty.md +7 -1
- package/docs/rules/{prefer-is-nil.md → prefer-is-nullish.md} +4 -4
- package/docs/rules/prefer-map.md +5 -1
- package/docs/rules/prefer-nullish-coalescing.md +9 -3
- package/docs/rules/prefer-remeda-typecheck.md +5 -1
- package/docs/rules/prefer-some.md +5 -1
- package/docs/rules/prefer-times.md +5 -1
- package/package.json +7 -4
@@ -1,4 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# remeda/prefer-nullish-coalescing
|
2
|
+
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
4
|
+
|
5
|
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
6
|
+
|
7
|
+
<!-- end auto-generated rule header -->
|
2
8
|
|
3
9
|
When checking if a variable is not nil as a test for a ternary equation, it's more coincise to just use the nullish coalescing operator.
|
4
10
|
|
@@ -9,13 +15,13 @@ This rule takes no arguments.
|
|
9
15
|
The following patterns are considered warnings:
|
10
16
|
|
11
17
|
```js
|
12
|
-
const myExpression = !
|
18
|
+
const myExpression = !isNullish(myVar) ? myVar : myOtherVar;
|
13
19
|
```
|
14
20
|
|
15
21
|
The following patterns are not considered warnings:
|
16
22
|
|
17
23
|
```js
|
18
|
-
const myExpression = !
|
24
|
+
const myExpression = !isNullish(myVar) ? mySecondVar : myThirdVar;
|
19
25
|
|
20
26
|
const myExpression = myVar ?? myOtherVar;
|
21
27
|
```
|
@@ -1,4 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# remeda/prefer-remeda-typecheck
|
2
|
+
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
4
|
+
|
5
|
+
<!-- end auto-generated rule header -->
|
2
6
|
|
3
7
|
Getting the specific type of a variable or expression can be done with `typeof` or `instanceof`. However, it's often more expressive to use the Remeda equivalent function
|
4
8
|
|
@@ -1,4 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# remeda/prefer-some
|
2
|
+
|
3
|
+
💼 This rule is enabled in the ✅ `recommended` config.
|
4
|
+
|
5
|
+
<!-- end auto-generated rule header -->
|
2
6
|
|
3
7
|
When comparing the index of an item with an `findIndex` method, it can be more expressive to use `R.some`, when only the sole existence of a matching item is taken into account.
|
4
8
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint-plugin-remeda",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.5.0",
|
4
4
|
"author": "Andrea Pontrandolfo <andrea.pontra@gmail.com>",
|
5
5
|
"description": "ESLint plugin for Remeda library.",
|
6
6
|
"type": "module",
|
@@ -16,6 +16,8 @@
|
|
16
16
|
"attw": "attw --pack .",
|
17
17
|
"qa": "pnpm typecheck && pnpm test && pnpm knip && pnpm publint && attw",
|
18
18
|
"nuke": "rm -rf node_modules pnpm-lock.yaml",
|
19
|
+
"update:eslint-docs": "eslint-doc-generator",
|
20
|
+
"lint:eslint-docs": "pnpm update:eslint-docs -- --check",
|
19
21
|
"semantic-release": "pnpm build && semantic-release"
|
20
22
|
},
|
21
23
|
"files": [
|
@@ -41,14 +43,15 @@
|
|
41
43
|
},
|
42
44
|
"devDependencies": {
|
43
45
|
"@arethetypeswrong/cli": "^0.15.4",
|
44
|
-
"@types/lodash": "^4.17.
|
46
|
+
"@types/lodash-es": "^4.17.12",
|
45
47
|
"@types/node": "^20.14.9",
|
46
48
|
"@vitest/coverage-v8": "^2.0.3",
|
47
49
|
"@vitest/ui": "^2.0.3",
|
48
50
|
"eslint": "9.10.0",
|
49
51
|
"eslint-config-sheriff": "^21.2.0",
|
50
52
|
"eslint-define-config": "^2.1.0",
|
51
|
-
"eslint-
|
53
|
+
"eslint-doc-generator": "^2.1.2",
|
54
|
+
"eslint-plugin-eslint-plugin": "^6.4.0",
|
52
55
|
"eslint-vitest-rule-tester": "^0.3.3",
|
53
56
|
"knip": "^5.29.1",
|
54
57
|
"prettier": "^3.3.2",
|
@@ -76,6 +79,6 @@
|
|
76
79
|
],
|
77
80
|
"license": "MIT",
|
78
81
|
"dependencies": {
|
79
|
-
"lodash": "^4.17.21"
|
82
|
+
"lodash-es": "^4.17.21"
|
80
83
|
}
|
81
84
|
}
|