@putout/plugin-conditions 4.2.0 → 4.3.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
@@ -13,6 +13,23 @@ npm i @putout/plugin-conditions -D
13
13
 
14
14
  ## Rules
15
15
 
16
+ - ✅ [add-return](#add-return);
17
+ - ✅ [apply-comparison-order](#apply-comparison-order);
18
+ - ✅ [apply-consistent-blocks](#apply-consistent-blocks);
19
+ - ✅ [apply-if](#apply-if);
20
+ - ✅ [convert-comparison-to-boolean](#convert-comparison-to-boolean);
21
+ - ✅ [convert-equal-to-strict-equal](#convert-equal-to-strict-equal);
22
+ - ✅ [evaluate](#evaluate);
23
+ - ✅ [merge-if-statements](#merge-if-statements);
24
+ - ✅ [remove-boolean](#remove-boolean);
25
+ - ✅ [remove-constant](#remove-constant);
26
+ - ✅ [remove-same-values-condition](hremove-same-values-condition);
27
+ - ✅ [remove-useless-else](#remove-ureless-else);
28
+ - ✅ [remove-zero](#remove-zero);
29
+ - ✅ [simplify](#simplify);
30
+
31
+ ## Config
32
+
16
33
  ```json
17
34
  {
18
35
  "rules": {
@@ -336,7 +353,7 @@ if (x)
336
353
  console.log();
337
354
  ```
338
355
 
339
- ## remove-same-values-condition"
356
+ ## remove-same-values-condition
340
357
 
341
358
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/e537d4ec636d4a9b849063a8326b70ae/661041b3fbb1e3678bf7f828e4c8bf6ca723f89d).
342
359
 
@@ -12,6 +12,7 @@ const notBlock = ({__b}) => !isBlockStatement(__b);
12
12
 
13
13
  module.exports.match = () => ({
14
14
  'if (__a) {__b} else {__c}': () => true,
15
+ 'if (__a) {__b} else __c': () => true,
15
16
  'if (__a) __b; else __body': notBlock,
16
17
  'if (__a) __body; else __b': ({__b}) => !isIfStatement(__b),
17
18
  'if (__a) {__b}': (vars, path) => {
@@ -35,7 +36,7 @@ module.exports.match = () => ({
35
36
  module.exports.replace = () => ({
36
37
  'if (__a) {if (__b) {__c}}': 'if (__a) if (__b) __c',
37
38
  'if (__a) {__b}': 'if (__a) __b',
38
- 'if (__a) {__b} else {__c}': () => 'if (__a) __b; else __c',
39
+ 'if (__a) {__b} else {__c}': 'if (__a) __b; else __c',
39
40
  'if (__a) __b; else __body': 'if (__a) {__b} else __body',
40
41
  'if (__a) __body; else __b': ({__b}, path) => {
41
42
  if (isBlockStatement(__b))
@@ -2,7 +2,7 @@
2
2
 
3
3
  const {types, operator} = require('putout');
4
4
 
5
- const {runInNewContext} = require('vm');
5
+ const {runInNewContext} = require('node:vm');
6
6
 
7
7
  const {
8
8
  replaceWith,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-conditions",
3
- "version": "4.2.0",
3
+ "version": "4.3.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",
@@ -33,13 +33,13 @@
33
33
  ],
34
34
  "devDependencies": {
35
35
  "@putout/plugin-for-of": "*",
36
- "@putout/test": "^7.0.0",
37
- "c8": "^8.0.0",
38
- "eslint": "^8.0.1",
39
- "eslint-plugin-n": "^16.0.0",
40
- "eslint-plugin-putout": "^21.0.0",
36
+ "@putout/test": "^9.0.0",
37
+ "c8": "^9.0.0",
38
+ "eslint": "^9.0.0",
39
+ "eslint-plugin-n": "^17.0.0",
40
+ "eslint-plugin-putout": "^22.0.0",
41
41
  "lerna": "^6.0.1",
42
- "madrun": "^9.0.0",
42
+ "madrun": "^10.0.0",
43
43
  "montag": "^1.2.1",
44
44
  "nodemon": "^3.0.1"
45
45
  },