diff --git a/docs/rules/valid-types.md b/docs/rules/valid-types.md index 7e346ae9e..f1aead8fd 100644 --- a/docs/rules/valid-types.md +++ b/docs/rules/valid-types.md @@ -902,5 +902,14 @@ function quux() { export function onGlobalEvent (selector, type, callback, options) { delegate(document, selector, type, callback, options) } + +/** + * Even if added to `structuredTags` as in our recommended config, + * we don't want `valid-types` to report since + * `jsdoc/require-next-type` already does this. + * @next + */ +function a () {} +// Settings: {"jsdoc":{"structuredTags":{"next":{"required":["type"]}}}} ```` diff --git a/src/rules/validTypes.js b/src/rules/validTypes.js index bc0bc10a7..d9ae185e5 100644 --- a/src/rules/validTypes.js +++ b/src/rules/validTypes.js @@ -328,7 +328,10 @@ export default iterateJsdoc(({ // REQUIRED TYPE const mustHaveTypePosition = utils.tagMustHaveTypePosition(tag.tag, otherModeMaps); - if (mustHaveTypePosition !== false && !tag.type) { + if (mustHaveTypePosition !== false && !tag.type && + // Auto-added to settings and has own rule already, so don't duplicate + tag.tag !== 'next' + ) { const modeInfo = mustHaveTypePosition === true ? '' : ` in "${mode}" mode`; report(`Tag @${tag.tag} must have a type${modeInfo}.`, null, tag); diff --git a/test/rules/assertions/validTypes.js b/test/rules/assertions/validTypes.js index b72198ea4..ab0ac0c7b 100644 --- a/test/rules/assertions/validTypes.js +++ b/test/rules/assertions/validTypes.js @@ -1886,5 +1886,27 @@ export default /** @type {import('../index.js').TestCases} */ ({ } `, }, + { + code: ` + /** + * Even if added to \`structuredTags\` as in our recommended config, + * we don't want \`valid-types\` to report since + * \`jsdoc/require-next-type\` already does this. + * @next + */ + function a () {} + `, + settings: { + jsdoc: { + structuredTags: { + next: { + required: [ + 'type', + ], + }, + }, + }, + }, + }, ], });