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 to handle edge cases when determining function arity. The focus is on correctly utilizing the package's getFunctionArity function and properly creating test function AST nodes with @babel/types.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Import getFunctionArity",
"description": "Code correctly imports the default export from @babel/helper-get-function-arity package",
"max_score": 10
},
{
"name": "Use getFunctionArity function",
"description": "Implementation calls getFunctionArity() function with a function AST node as the argument",
"max_score": 15
},
{
"name": "Empty parameter test",
"description": "Test creates a function with empty params array using @babel/types (e.g., t.functionExpression with params: []) and verifies arity is 0",
"max_score": 15
},
{
"name": "All optional parameters test",
"description": "Test creates function with all t.assignmentPattern parameters and verifies arity is 0",
"max_score": 15
},
{
"name": "Rest parameter only test",
"description": "Test creates function with only t.restElement parameter and verifies arity is 0",
"max_score": 15
},
{
"name": "Mixed required and optional test",
"description": "Test creates function with t.identifier parameters followed by t.assignmentPattern parameters and verifies correct required count",
"max_score": 15
},
{
"name": "Required plus rest test",
"description": "Test creates function with t.identifier parameters followed by t.restElement and verifies correct required count",
"max_score": 15
}
]
}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