Helper function to get function arity by analyzing parameter lists for assignment patterns and rest parameters
95
{
"context": "This criteria evaluates how well the engineer uses @babel/helper-get-function-arity and related Babel packages to analyze function parameter patterns, specifically focusing on the complex parameter pattern handling capability of determining required versus optional parameters.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Uses @babel/parser",
"description": "Correctly uses @babel/parser to parse the function code string into an AST. Should call parse() or parseExpression() with appropriate options.",
"max_score": 15
},
{
"name": "Uses getFunctionArity",
"description": "Imports and uses the default export from @babel/helper-get-function-arity (often named getFunctionArity or similar) to determine the required parameter count. This is the core package function being evaluated.",
"max_score": 30
},
{
"name": "Extracts function node",
"description": "Correctly extracts the function node from the parsed AST. Handles different function types (FunctionDeclaration, FunctionExpression, ArrowFunctionExpression) or uses appropriate traversal to locate the function.",
"max_score": 10
},
{
"name": "Passes to getFunctionArity",
"description": "Correctly passes the function AST node to getFunctionArity() and uses the returned arity value as the requiredCount in the output.",
"max_score": 20
},
{
"name": "Uses @babel/types checks",
"description": "Uses type checking functions from @babel/types to identify parameter patterns (e.g., isIdentifier, isObjectPattern, isArrayPattern, isRestElement, isAssignmentPattern) for building the patterns array.",
"max_score": 15
},
{
"name": "Detects rest parameters",
"description": "Uses @babel/types isRestElement() to detect rest parameters and correctly sets the hasRest boolean in the output.",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel--helper-get-function-aritydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10