@putout/plugin-conditions 6.6.0 → 7.1.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 CHANGED
@@ -28,7 +28,6 @@ npm i @putout/plugin-conditions -D
28
28
  - ✅ [remove-same-values-condition](hremove-same-values-condition);
29
29
  - ✅ [remove-useless-else](#remove-ureless-else);
30
30
  - ✅ [remove-zero](#remove-zero);
31
- - ✅ [remove-undefined](#remove-undefined);
32
31
  - ✅ [simplify](#simplify);
33
32
  - ✅ [wrap-with-block](#wrap-with-block);
34
33
 
@@ -49,7 +48,6 @@ npm i @putout/plugin-conditions -D
49
48
  "conditions/remove-boolean": "on",
50
49
  "conditions/remove-constant": "on",
51
50
  "conditions/remove-zero": "on",
52
- "conditions/remove-undefined": "on",
53
51
  "conditions/remove-useless-else": "on",
54
52
  "conditions/remove-same-values-condition": "on",
55
53
  "conditions/merge-if-statements": "on",
@@ -260,12 +258,16 @@ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/fabfc16a5a
260
258
 
261
259
  ```js
262
260
  const check = (references) => !(references > 3);
261
+
262
+ return !(nextNode.type !== 'text' || nextNode.value !== ' ');
263
263
  ```
264
264
 
265
265
  ### ✅ Example of correct code
266
266
 
267
267
  ```js
268
268
  const check = (references) => references <= 3;
269
+
270
+ return nextNode.type === 'text' && nextNode.value === ' ';
269
271
  ```
270
272
 
271
273
  ## remove-boolean
@@ -324,24 +326,6 @@ if (!b) {}
324
326
  if (b) {}
325
327
  ```
326
328
 
327
- ## remove-undefined
328
-
329
- ### ❌ Example of incorrect code
330
-
331
- ```js
332
- if (b === undefined) {}
333
-
334
- if (b !== undefined) {}
335
- ```
336
-
337
- ### ✅ Example of correct code
338
-
339
- ```js
340
- if (!b) {}
341
-
342
- if (b) {}
343
- ```
344
-
345
329
  ## simplify
346
330
 
347
331
  ### ❌ Example of incorrect code
@@ -415,6 +399,13 @@ if (x)
415
399
  console.log();
416
400
  ```
417
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
+
418
409
  ## remove-same-values-condition
419
410
 
420
411
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/e537d4ec636d4a9b849063a8326b70ae/661041b3fbb1e3678bf7f828e4c8bf6ca723f89d).
@@ -478,13 +469,6 @@ if (a) {
478
469
  }
479
470
  ```
480
471
 
481
- ### Comparison
482
-
483
- Linter | Rule | Fix
484
- --------|-------|------------|
485
- 🐊 **Putout** | [`conditions/remove-useless-else`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-debugger#readme) | ✅
486
- ⏣ **ESLint** | [`no-else-return`](https://eslint.org/docs/rules/no-else-return) | ✅
487
-
488
472
  ## License
489
473
 
490
474
  MIT
package/lib/index.js CHANGED
@@ -9,7 +9,6 @@ const convertEqualToStrictEqual = require('./convert-equal-to-strict-equal');
9
9
  const mergeIfStatements = require('./merge-if-statements');
10
10
  const removeBoolean = require('./remove-boolean');
11
11
  const removeZero = require('./remove-zero');
12
- const removeUndefined = require('./remove-undefined');
13
12
  const removeUselessElse = require('./remove-useless-else');
14
13
  const simplify = require('./simplify');
15
14
  const removeSameValuesCondition = require('./remove-same-values-condition');
@@ -28,7 +27,6 @@ module.exports.rules = {
28
27
  'merge-if-statements': mergeIfStatements,
29
28
  'remove-boolean': removeBoolean,
30
29
  'remove-zero': removeZero,
31
- 'remove-undefined': removeUndefined,
32
30
  'remove-useless-else': removeUselessElse,
33
31
  simplify,
34
32
  'remove-same-values-condition': removeSameValuesCondition,
@@ -5,4 +5,5 @@ 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',
8
9
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-conditions",
3
- "version": "6.6.0",
3
+ "version": "7.1.0",
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",
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- const {createAvoidInAssertions} = require('../avoid-in-assertions');
4
-
5
- module.exports = createAvoidInAssertions(undefined);