Skip to content

Commit

Permalink
fix: regression with checking TS MethodDefinition params
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Apr 13, 2022
1 parent 288363e commit 041de5f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jsdocUtils.js
Expand Up @@ -271,7 +271,7 @@ const getFunctionParameterNames = (
throw new Error(`Unsupported function signature format: \`${param.type}\`.`);
};

return functionNode.params.map((param) => {
return (functionNode.params || functionNode.value.params).map((param) => {
return getParamName(param);
});
};
Expand Down
24 changes: 24 additions & 0 deletions test/rules/assertions/requireParam.js
Expand Up @@ -3366,5 +3366,29 @@ export default {
sourceType: 'module',
},
},
{
code: `
/**
* [A description]
*/
class A {
/**
* @param config
*/
constructor (config: SomeConfig) {
super(config);
}
}
`,
ignoreReadme: true,
options: [
{
contexts: [
'MethodDefinition',
],
},
],
parser: require.resolve('@typescript-eslint/parser'),
},
],
};

0 comments on commit 041de5f

Please sign in to comment.