Skip to content

Commit

Permalink
feat(valid-types): change allowEmptyNamepaths default to false,…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
brettz9 committed Jul 19, 2020
1 parent 89f2ad0 commit 842381a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/rules/validTypes.js
Expand Up @@ -11,7 +11,7 @@ export default iterateJsdoc(({
settings,
}) => {
const {
allowEmptyNamepaths = true,
allowEmptyNamepaths = false,
} = context.options[0] || {};
const {mode} = settings;
if (!jsdoc.tags) {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -174,7 +176,7 @@ export default iterateJsdoc(({
additionalProperies: false,
properties: {
allowEmptyNamepaths: {
default: true,
default: false,
type: 'boolean',
},
},
Expand Down

0 comments on commit 842381a

Please sign in to comment.