@putout/plugin-variables 1.3.0 → 1.4.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
@@ -24,6 +24,7 @@ npm i @putout/plugin-variables -D
24
24
  - ✅ [remove-useless-duplicate](#remove-useless-duplicate);
25
25
  - ✅ [remove-useless-variables](#remove-useless-variables);
26
26
  - ✅ [remove-useless-rename](#remove-useless-rename);
27
+ - ✅ [remove-unused](#remove-unused);
27
28
  - ✅ [split-declarations](#split-declarations);
28
29
 
29
30
  ## Config
@@ -40,6 +41,7 @@ npm i @putout/plugin-variables -D
40
41
  "variables/remove-useless-duplicate": "on",
41
42
  "variables/remove-useless-rename": "on",
42
43
  "variables/remove-useless-remove": "on",
44
+ "variables/remove-unused": "on",
43
45
  "variables/split-declarations": "on"
44
46
  }
45
47
  }
@@ -40,6 +40,7 @@ export default ({use, declare, addParams}) => {
40
40
 
41
41
  const traverseTmpl = traverseTemplateLiteral(use);
42
42
  const traverseArray = traverseArrayExpression(use);
43
+ const declareArray = traverseArrayExpression(declare);
43
44
 
44
45
  return {
45
46
  'ObjectExpression'(path) {
@@ -144,6 +145,11 @@ export default ({use, declare, addParams}) => {
144
145
  continue;
145
146
  }
146
147
 
148
+ if (elPath.isArrayPattern()) {
149
+ declareArray(elPath.get('elements'));
150
+ continue;
151
+ }
152
+
147
153
  if (elPath.isAssignmentPattern()) {
148
154
  const leftPath = elPath.get('left');
149
155
  const rightPath = elPath.get('right');
@@ -125,7 +125,7 @@ export const traverseArrayExpression = (use) => {
125
125
  for (const elementPath of elementsPaths) {
126
126
  const {node} = elementPath;
127
127
 
128
- if (isObjectExpression(node))
128
+ if (node.properties)
129
129
  traverseObjExpression(elementPath.get('properties'));
130
130
  }
131
131
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-variables",
3
- "version": "1.3.0",
3
+ "version": "1.4.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",
@@ -31,8 +31,7 @@
31
31
  "plugin",
32
32
  "remove",
33
33
  "useless",
34
- "variables",
35
- "for-of"
34
+ "variables"
36
35
  ],
37
36
  "devDependencies": {
38
37
  "@putout/eslint-flat": "^3.0.0",
@@ -42,15 +41,15 @@
42
41
  "@putout/plugin-minify": "*",
43
42
  "@putout/plugin-nodejs": "*",
44
43
  "@putout/plugin-putout": "*",
45
- "@putout/plugin-remove-useless-array-from": "*",
46
44
  "@putout/plugin-reuse-duplicate-init": "*",
47
45
  "@putout/test": "^14.0.0",
48
46
  "c8": "^10.0.0",
49
- "eslint": "v10.0.0-alpha.0",
47
+ "eslint": "^10.0.0-alpha.0",
50
48
  "eslint-plugin-n": "^17.0.0",
51
49
  "eslint-plugin-putout": "^29.0.0",
52
50
  "just-camel-case": "^6.2.0",
53
51
  "madrun": "^11.0.0",
52
+ "montag": "^1.2.1",
54
53
  "nodemon": "^3.0.1",
55
54
  "supertape": "^11.3.1",
56
55
  "try-catch": "^3.0.1"