@putout/plugin-types 1.5.0 → 1.6.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.
@@ -14,4 +14,3 @@ module.exports.replace = ({options}) => {
14
14
  },
15
15
  };
16
16
  };
17
-
@@ -1,7 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const {operator} = require('putout');
4
- const {compare, getBindingPath} = operator;
4
+ const {
5
+ compare,
6
+ getBindingPath,
7
+ } = operator;
5
8
 
6
9
  const NAMES = {
7
10
  function: 'isFn',
@@ -57,8 +60,10 @@ function isBind(path, name) {
57
60
  if (!bindingPath)
58
61
  return false;
59
62
 
63
+ if (!bindingPath.isVariableDeclarator())
64
+ return false;
65
+
60
66
  const {body} = bindingPath.node.init;
61
67
 
62
68
  return !compare(body, fnBody);
63
69
  }
64
-
@@ -11,4 +11,3 @@ module.exports.declare = () => ({
11
11
  isSymbol: `const isSymbol = (a) => typeof a === 'symbol'`,
12
12
  isNull: `const isNull = (a) => !a && typeof a === 'object'`,
13
13
  });
14
-
package/lib/index.js CHANGED
@@ -12,4 +12,3 @@ module.exports.rules = {
12
12
  ...getRule('remove-double-negations'),
13
13
  ...getRule('remove-useless-typeof'),
14
14
  };
15
-
@@ -13,4 +13,3 @@ module.exports.replace = () => ({
13
13
  'do __a; while(!!__b)': 'do __a; while(__b)',
14
14
  'for (__a; !!__b; __c) __d': 'for (__a; __b; __c) __d',
15
15
  });
16
-
@@ -13,4 +13,3 @@ module.exports.replace = () => ({
13
13
  'for (; Boolean(__b);__c) __d': 'for (; __b; __c) __d',
14
14
  'for (; Boolean(__b);) __d': 'for (; __b;) __d',
15
15
  });
16
-
@@ -5,4 +5,3 @@ module.exports.report = () => `Useless typeof should be avoided`;
5
5
  module.exports.replace = () => ({
6
6
  'typeof typeof __a': 'typeof __a',
7
7
  });
8
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-types",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin adds ability to transform code related to types assertions",
@@ -35,7 +35,7 @@
35
35
  "@putout/test": "^6.0.0",
36
36
  "c8": "^7.5.0",
37
37
  "eslint": "^8.0.1",
38
- "eslint-plugin-n": "^15.2.4",
38
+ "eslint-plugin-n": "^16.0.0",
39
39
  "eslint-plugin-putout": "^17.0.0",
40
40
  "lerna": "^6.0.1",
41
41
  "madrun": "^9.0.0",