@putout/plugin-variables 1.6.0 → 2.0.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
@@ -102,7 +102,7 @@ const {
102
102
  a,
103
103
  b,
104
104
  operator,
105
- } = putout;
105
+ } = require('putout');
106
106
 
107
107
  const {replaceWith} = operator;
108
108
  ```
@@ -112,6 +112,9 @@ export const traverse = ({push}) => ({
112
112
  if (!nextPath.isExpressionStatement())
113
113
  return;
114
114
 
115
+ if (nextPath.get('expression').isIdentifier({name: 'from'}))
116
+ return;
117
+
115
118
  const {expression} = nextPath.node;
116
119
 
117
120
  if (isInit(expression))
@@ -118,11 +118,13 @@ export const traverseObjectExpression = (use) => {
118
118
  };
119
119
  };
120
120
 
121
+ const exists = ({node}) => Boolean(node);
122
+
121
123
  export const traverseArrayExpression = (use) => {
122
124
  const traverseObjExpression = traverseObjectExpression(use);
123
125
 
124
126
  return (elementsPaths) => {
125
- for (const elementPath of elementsPaths) {
127
+ for (const elementPath of elementsPaths.filter(exists)) {
126
128
  const {node} = elementPath;
127
129
 
128
130
  if (isIdentifier(node))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-variables",
3
- "version": "1.6.0",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin adds ability to find and remove useless",
@@ -34,7 +34,7 @@
34
34
  "variables"
35
35
  ],
36
36
  "devDependencies": {
37
- "@putout/eslint-flat": "^3.0.0",
37
+ "@putout/eslint-flat": "^4.0.0",
38
38
  "@putout/plugin-declare": "*",
39
39
  "@putout/plugin-for-of": "*",
40
40
  "@putout/plugin-maybe": "*",
@@ -43,24 +43,24 @@
43
43
  "@putout/plugin-putout": "*",
44
44
  "@putout/plugin-reuse-duplicate-init": "*",
45
45
  "@putout/plugin-tape": "*",
46
- "@putout/test": "^14.0.0",
46
+ "@putout/test": "^15.0.0",
47
47
  "c8": "^10.0.0",
48
- "eslint": "^10.0.0-alpha.0",
48
+ "eslint": "^10.0.0",
49
49
  "eslint-plugin-n": "^17.0.0",
50
- "eslint-plugin-putout": "^29.0.0",
50
+ "eslint-plugin-putout": "^31.0.0",
51
51
  "just-camel-case": "^6.2.0",
52
- "madrun": "^11.0.0",
52
+ "madrun": "^13.0.0",
53
53
  "montag": "^1.2.1",
54
54
  "nodemon": "^3.0.1",
55
- "supertape": "^11.3.1",
56
- "try-catch": "^3.0.1"
55
+ "supertape": "^12.0.0",
56
+ "try-catch": "^4.0.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "putout": ">=41"
59
+ "putout": ">=42"
60
60
  },
61
61
  "license": "MIT",
62
62
  "engines": {
63
- "node": ">=20"
63
+ "node": ">=22"
64
64
  },
65
65
  "publishConfig": {
66
66
  "access": "public"