Skip to content

Commit 7ca8771

Browse files
committed
Added support for rest parameter (...args).
1 parent 0418908 commit 7ca8771

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/jsdocUtils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ const getFunctionParameterNames = (functionNode : Object) : Array<string> => {
1515
return '<ObjectPattern>';
1616
}
1717

18+
if (param.type === 'RestElement') {
19+
return param.argument.name;
20+
}
21+
1822
throw new Error('Unsupported function signature format.');
1923
});
2024
};

tests/rules/assertions/checkParamNames.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ export default {
174174
}
175175
`
176176
},
177+
{
178+
code: `
179+
/**
180+
* @param args
181+
*/
182+
function quux (...args) {
183+
184+
}
185+
`
186+
},
177187
{
178188
code: `
179189
/**

0 commit comments

Comments
 (0)