Babel plugin that transforms ECMAScript object rest and spread syntax into ES5-compatible code.
85
Quality
Pending
Does it follow best practices?
Impact
85%
1.06xAverage score across 10 eval scenarios
Pending
The risk profile of this skill
Build a tool that analyzes JavaScript source code to find all variables that are declared but never used. The tool should parse the code, traverse the abstract syntax tree, and report unused variables along with their locations.
The analyzer should:
var, let, const)The analyzer should handle:
The analyzer should return an array of objects, where each object represents an unused variable:
[
{ name: "variableName", line: 5 },
{ name: "anotherVar", line: 12 }
]If all variables are used, return an empty array.
const, it reports that variable @test@generates
/**
* Analyzes JavaScript source code to find unused variables
*
* @param {string} code - The JavaScript source code to analyze
* @returns {Array<{name: string, line: number}>} Array of unused variables with their line numbers
*/
function analyzeUnusedVariables(code) {
// IMPLEMENTATION HERE
}
module.exports = { analyzeUnusedVariables };Provides JavaScript parsing capabilities to convert source code into an abstract syntax tree.
Provides AST traversal capabilities with visitor pattern support for analyzing the syntax tree.
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10