@putout/plugin-conditions 7.0.0 β 7.1.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/README.md +11 -7
- package/lib/reverse-condition/index.js +2 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -258,12 +258,16 @@ Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/fabfc16a5a
|
|
|
258
258
|
|
|
259
259
|
```js
|
|
260
260
|
const check = (references) => !(references > 3);
|
|
261
|
+
|
|
262
|
+
return !(nextNode.type !== 'text' || nextNode.value !== ' ');
|
|
261
263
|
```
|
|
262
264
|
|
|
263
265
|
### β
Example of correct code
|
|
264
266
|
|
|
265
267
|
```js
|
|
266
268
|
const check = (references) => references <= 3;
|
|
269
|
+
|
|
270
|
+
return nextNode.type === 'text' && nextNode.value === ' ';
|
|
267
271
|
```
|
|
268
272
|
|
|
269
273
|
## remove-boolean
|
|
@@ -395,6 +399,13 @@ if (x)
|
|
|
395
399
|
console.log();
|
|
396
400
|
```
|
|
397
401
|
|
|
402
|
+
### Comparison
|
|
403
|
+
|
|
404
|
+
Linter | Rule | Fix
|
|
405
|
+
--------|-------|------------|
|
|
406
|
+
π **Putout** | [`conditions/remove-useless-else`](https://github.com/coderaiser/putout/tree/master/packages/plugin-conditions#remove-useless-else) | β
|
|
407
|
+
β£ **ESLint** | [`no-else-return`](https://eslint.org/docs/rules/no-else-return) | β
|
|
408
|
+
|
|
398
409
|
## remove-same-values-condition
|
|
399
410
|
|
|
400
411
|
Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/e537d4ec636d4a9b849063a8326b70ae/661041b3fbb1e3678bf7f828e4c8bf6ca723f89d).
|
|
@@ -458,13 +469,6 @@ if (a) {
|
|
|
458
469
|
}
|
|
459
470
|
```
|
|
460
471
|
|
|
461
|
-
### Comparison
|
|
462
|
-
|
|
463
|
-
Linter | Rule | Fix
|
|
464
|
-
--------|-------|------------|
|
|
465
|
-
π **Putout** | [`conditions/remove-useless-else`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-debugger#readme) | β
|
|
466
|
-
β£ **ESLint** | [`no-else-return`](https://eslint.org/docs/rules/no-else-return) | β
|
|
467
|
-
|
|
468
472
|
## License
|
|
469
473
|
|
|
470
474
|
MIT
|
|
@@ -5,4 +5,6 @@ module.exports.report = () => `Avoid useless '!'`;
|
|
|
5
5
|
module.exports.replace = () => ({
|
|
6
6
|
'!(__a > __b)': '__a <= __b',
|
|
7
7
|
'!(__a !== __b && __c === __d)': '__a === __b || __c !== __d',
|
|
8
|
+
'!(__a !== __b || __c !== __d)': '__a === __b && __c === __d',
|
|
9
|
+
'!(__a || __b)': '!__a && !__b',
|
|
8
10
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-conditions",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "πPutout plugin adds support of conditions transformations",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"c8": "^10.0.0",
|
|
38
38
|
"eslint": "^9.0.0",
|
|
39
39
|
"eslint-plugin-n": "^17.0.0",
|
|
40
|
-
"eslint-plugin-putout": "^
|
|
40
|
+
"eslint-plugin-putout": "^24.0.0",
|
|
41
41
|
"lerna": "^6.0.1",
|
|
42
42
|
"madrun": "^10.0.0",
|
|
43
43
|
"montag": "^1.2.1",
|
|
44
44
|
"nodemon": "^3.0.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"putout": ">=
|
|
47
|
+
"putout": ">=38"
|
|
48
48
|
},
|
|
49
49
|
"license": "MIT",
|
|
50
50
|
"engines": {
|