CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel--plugin-proposal-object-rest-spread

Babel plugin that transforms ECMAScript object rest and spread syntax into ES5-compatible code.

85

1.06x

Quality

Pending

Does it follow best practices?

Impact

85%

1.06x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-5/

JavaScript Function Analyzer

A utility that analyzes JavaScript code files to identify and report on unused function declarations and function expressions.

Capabilities

Identifies unused function declarations

  • Given a code string "function foo() {} function bar() {} foo();", it identifies that bar is declared but never called @test
  • Given a code string with nested scopes "function outer() { function inner() {} } outer();", it identifies that inner is declared but never used @test

Identifies unused function expressions

  • Given a code string "const add = function() {}; const sub = function() {}; add();", it identifies that sub is assigned but never called @test

Handles function usage correctly

  • Given a code string "function greet() {} greet(); greet();", it returns an empty array since greet is used @test
  • Given a code string with only function calls and no declarations "foo(); bar();", it returns an empty array @test

Implementation

@generates

API

/**
 * Analyzes JavaScript code to find unused functions.
 *
 * @param {string} code - The JavaScript code to analyze
 * @returns {Array<{name: string, line: number, type: string}>} Array of unused functions,
 *   where each object contains the function name, line number, and type ('declaration' or 'expression')
 * @throws {Error} If the code cannot be parsed
 */
function findUnusedFunctions(code) {
  // IMPLEMENTATION HERE
}

module.exports = { findUnusedFunctions };

Dependencies { .dependencies }

@babel/parser { .dependency }

Provides JavaScript parsing capabilities to convert source code into an Abstract Syntax Tree (AST).

@babel/traverse { .dependency }

Provides AST traversal capabilities to visit and analyze nodes in the syntax tree.

@babel/types { .dependency }

Provides utilities for checking AST node types and working with AST nodes.

tile.json