From c8d06116f114809d96aa87e76ce8cadf719c232d Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Mon, 22 Jul 2019 16:39:24 -0700 Subject: [PATCH] fix(require-param): skip destructuring; fixes #352 (though still need to handle #11 ) --- README.md | 11 +++++++++++ src/rules/requireParam.js | 3 +++ test/rules/assertions/requireParam.js | 14 ++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/README.md b/README.md index ffe930c19..6f2646cce 100644 --- a/README.md +++ b/README.md @@ -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}) { + // ... +} ```` diff --git a/src/rules/requireParam.js b/src/rules/requireParam.js index 574ac8d5a..4291ccf78 100644 --- a/src/rules/requireParam.js +++ b/src/rules/requireParam.js @@ -21,6 +21,9 @@ export default iterateJsdoc(({ } functionParameterNames.forEach((functionParameterName) => { + if (['', ''].includes(functionParameterName)) { + return; + } if (!jsdocParameterNames.includes(functionParameterName)) { report(`Missing JSDoc @${utils.getPreferredTagName({tagName: 'param'})} "${functionParameterName}" declaration.`); } diff --git a/test/rules/assertions/requireParam.js b/test/rules/assertions/requireParam.js index a8294964d..2cb4b7d17 100644 --- a/test/rules/assertions/requireParam.js +++ b/test/rules/assertions/requireParam.js @@ -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}) { + // ... + } + ` } ] };