@putout/plugin-conditions 6.3.1 → 6.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.
@@ -5,8 +5,7 @@ const {replaceWith} = operator;
5
5
  const {
6
6
  isBlockStatement,
7
7
  BlockStatement,
8
- isExpressionStatement,
9
- isIfStatement,
8
+ isVariableDeclaration,
10
9
  } = types;
11
10
 
12
11
  module.exports.report = () => `Use consistent blocks`;
@@ -75,7 +74,7 @@ module.exports.filter = (path) => {
75
74
  if (is && body.length === 1) {
76
75
  const [first] = body;
77
76
 
78
- if (!isExpressionStatement(first) && !isIfStatement(first))
77
+ if (isVariableDeclaration(first))
79
78
  continue;
80
79
  }
81
80
 
@@ -102,7 +101,7 @@ module.exports.filter = (path) => {
102
101
  if (coupleCount === paths.length)
103
102
  return false;
104
103
 
105
- return !(count !== 1 && count === paths.length);
104
+ return count === 1 || count !== paths.length;
106
105
  };
107
106
 
108
107
  function getAllNodes(path, nodes = []) {
@@ -4,4 +4,5 @@ module.exports.report = () => `Avoid useless '!'`;
4
4
 
5
5
  module.exports.replace = () => ({
6
6
  '!(__a > __b)': '__a <= __b',
7
+ '!(__a !== __b && __c === __d)': '__a === __b || __c !== __d',
7
8
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-conditions",
3
- "version": "6.3.1",
3
+ "version": "6.5.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",