Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@putout/plugin-remove-unused-variables

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/plugin-remove-unused-variables - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

25

lib/get-vars/get-vars.js

@@ -12,2 +12,3 @@ 'use strict';

isFunctionDeclaration,
isArrayExpression,
} = require('@babel/types');

@@ -29,2 +30,3 @@

const traverseTmpl = traverseTemplateLiteral(use);
const traverseArray = traverseArrayExpression(use);

@@ -35,2 +37,3 @@ return {

const {init} = node;
const idPath = path.get('id');

@@ -40,3 +43,3 @@ if (isIdentifier(node.id)) {

} else if (isObjectPattern(node.id)) {
path.get('id').traverse({
idPath.traverse({
ObjectProperty(propPath) {

@@ -54,3 +57,3 @@ if (!isIdentifier(propPath.node.value))

} else if (isArrayPattern(node.id)) {
path.get('id').traverse({
idPath.traverse({
Identifier(elPath) {

@@ -79,2 +82,4 @@ const {elements} = node.id;

traverseTmpl(path, init.expressions);
else if (isArrayExpression(init))
traverseArray(initPath.get('elements'));
},

@@ -428,2 +433,15 @@

const traverseArrayExpression = (use) => {
const traverseObjExpression = traverseObjectExpression(use);
return (elementsPaths) => {
for (const elementPath of elementsPaths) {
const {node} = elementPath;
if (isObjectExpression(node))
traverseObjExpression(elementPath.get('properties'));
}
};
};
const traverseAssignmentExpression = (use) => {

@@ -433,2 +451,3 @@ const traverseObjPattern = traverseObjectPattern(use);

const traverseTmpl = traverseTemplateLiteral(use);
const traverseArray = traverseArrayExpression(use);

@@ -453,2 +472,4 @@ return (path) => {

traverseTmpl(path, right.expressions);
else if (isArrayExpression(right))
traverseArray(path.get('right.elements'));
};

@@ -455,0 +476,0 @@ };

2

package.json
{
"name": "@putout/plugin-remove-unused-variables",
"version": "1.2.0",
"version": "1.3.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

@@ -5,0 +5,0 @@ "description": "putout plugin adds ability to find and remove unused variables",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc