diff --git a/docs/rules/check-tag-names.md b/docs/rules/check-tag-names.md index a38e25a26..d37eb6ba0 100644 --- a/docs/rules/check-tag-names.md +++ b/docs/rules/check-tag-names.md @@ -1122,5 +1122,11 @@ interface WebTwain { * @satisfies */ // Settings: {"jsdoc":{"mode":"typescript"}} + +/** + * @module + * A comment related to the module + */ +// "jsdoc/check-tag-names": ["error"|"warn", {"typed":true}] ```` diff --git a/src/rules/checkTagNames.js b/src/rules/checkTagNames.js index 8aa07bc20..d7adc39a0 100644 --- a/src/rules/checkTagNames.js +++ b/src/rules/checkTagNames.js @@ -143,6 +143,10 @@ export default iterateJsdoc(({ return false; } + if (node === null) { + return false; + } + if (context.getFilename().endsWith('.d.ts') && [ 'Program', null, undefined, ].includes(node?.parent?.type)) { diff --git a/test/rules/assertions/checkTagNames.js b/test/rules/assertions/checkTagNames.js index 955f21cf7..b7d42dbf7 100644 --- a/test/rules/assertions/checkTagNames.js +++ b/test/rules/assertions/checkTagNames.js @@ -1455,5 +1455,18 @@ export default { }, }, }, + { + code: ` + /** + * @module + * A comment related to the module + */ + `, + options: [ + { + typed: true, + }, + ], + }, ], };