Skip to content

Commit

Permalink
fix(require-param): skip destructuring; fixes #352 (though still need…
Browse files Browse the repository at this point in the history
… to handle #11 )
  • Loading branch information
brettz9 authored and l1bbcsg committed Aug 8, 2019
1 parent ea3e057 commit c8d0611
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -6237,6 +6237,17 @@ export class SomeClass {
*/
constructor(private property: string) {}
}

/**
* Assign the project to an employee.
*
* @param {object} employee - The employee who is responsible for the project.
* @param {string} employee.name - The name of the employee.
* @param {string} employee.department - The employee's department.
*/
function assign({name, department}) {
// ...
}
````


Expand Down
3 changes: 3 additions & 0 deletions src/rules/requireParam.js
Expand Up @@ -21,6 +21,9 @@ export default iterateJsdoc(({
}

functionParameterNames.forEach((functionParameterName) => {
if (['<ObjectPattern>', '<ArrayPattern>'].includes(functionParameterName)) {
return;
}
if (!jsdocParameterNames.includes(functionParameterName)) {
report(`Missing JSDoc @${utils.getPreferredTagName({tagName: 'param'})} "${functionParameterName}" declaration.`);
}
Expand Down
14 changes: 14 additions & 0 deletions test/rules/assertions/requireParam.js
Expand Up @@ -788,6 +788,20 @@ export default {
parserOptions: {
sourceType: 'module'
}
},
{
code: `
/**
* Assign the project to an employee.
*
* @param {object} employee - The employee who is responsible for the project.
* @param {string} employee.name - The name of the employee.
* @param {string} employee.department - The employee's department.
*/
function assign({name, department}) {
// ...
}
`
}
]
};

0 comments on commit c8d0611

Please sign in to comment.