From 842381a84b5c93594672c105c75538669eb1f732 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sat, 18 Jul 2020 20:13:30 +0800 Subject: [PATCH] feat(`valid-types`): change `allowEmptyNamepaths` default to `false`, ensuring tags which expect names per docs will be reported Also ensures `see` tag with only an inline link tag is not treated as empty. --- src/rules/validTypes.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rules/validTypes.js b/src/rules/validTypes.js index 3eed1753c..a3fdb9d3e 100644 --- a/src/rules/validTypes.js +++ b/src/rules/validTypes.js @@ -11,7 +11,7 @@ export default iterateJsdoc(({ settings, }) => { const { - allowEmptyNamepaths = true, + allowEmptyNamepaths = false, } = context.options[0] || {}; const {mode} = settings; if (!jsdoc.tags) { @@ -122,7 +122,9 @@ export default iterateJsdoc(({ if (tagMustHaveNamePosition !== false && !tag.name && !allowEmptyNamepaths && ![ 'param', 'arg', 'argument', 'property', 'prop', - ].includes(tag.tag)) { + ].includes(tag.tag) && + (tag.tag !== 'see' || !tag.description.includes('{@link')) + ) { const modeInfo = tagMustHaveNamePosition === true ? '' : ` in "${mode}" mode`; report(`Tag @${tag.tag} must have a name/namepath${modeInfo}.`, null, tag); @@ -174,7 +176,7 @@ export default iterateJsdoc(({ additionalProperies: false, properties: { allowEmptyNamepaths: { - default: true, + default: false, type: 'boolean', }, },