diff --git a/README.md b/README.md index c6c5a0e54..4da221eef 100644 --- a/README.md +++ b/README.md @@ -9212,6 +9212,12 @@ function quux() { } // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["name"]}}}} // Message: Cannot add "name" to `require` with the tag's `name` set to `false` + +class Test { + aFunc() {} +} +// Options: [{"checkConstructors":false,"require":{"ArrowFunctionExpression":true,"ClassDeclaration":false,"ClassExpression":true,"FunctionDeclaration":true,"FunctionExpression":true,"MethodDefinition":true}}] +// Message: Missing JSDoc comment. ```` The following patterns are not considered problems: diff --git a/src/rules/requireJsdoc.js b/src/rules/requireJsdoc.js index 62a4a95f7..d104a6d61 100644 --- a/src/rules/requireJsdoc.js +++ b/src/rules/requireJsdoc.js @@ -185,7 +185,7 @@ export default { // For those who have options configured against ANY constructors (or setters or getters) being reported if (jsdocUtils.exemptSpeciaMethods( - jsDocNode, node, context, [OPTIONS_SCHEMA], + {tags: []}, node, context, [OPTIONS_SCHEMA], )) { return; } diff --git a/test/rules/assertions/requireJsdoc.js b/test/rules/assertions/requireJsdoc.js index bad5d6571..24cbd9c01 100644 --- a/test/rules/assertions/requireJsdoc.js +++ b/test/rules/assertions/requireJsdoc.js @@ -2428,6 +2428,36 @@ export default { }, }, }, + { + code: ` + class Test { + aFunc() {} + } + `, + errors: [{ + line: 3, + message: 'Missing JSDoc comment.', + }], + options: [{ + checkConstructors: false, + require: { + ArrowFunctionExpression: true, + ClassDeclaration: false, + ClassExpression: true, + FunctionDeclaration: true, + FunctionExpression: true, + MethodDefinition: true, + }, + }], + output: ` + class Test { + /** + * + */ + aFunc() {} + } + `, + }, ], valid: [{ code: `