Skip to content

Commit

Permalink
fix: check-tag-names crash on module comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen authored and brettz9 committed May 15, 2023
1 parent b9372c6 commit 89b81ce
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/rules/check-tag-names.md
Expand Up @@ -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}]
````

4 changes: 4 additions & 0 deletions src/rules/checkTagNames.js
Expand Up @@ -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)) {
Expand Down
13 changes: 13 additions & 0 deletions test/rules/assertions/checkTagNames.js
Expand Up @@ -1455,5 +1455,18 @@ export default {
},
},
},
{
code: `
/**
* @module
* A comment related to the module
*/
`,
options: [
{
typed: true,
},
],
},
],
};

0 comments on commit 89b81ce

Please sign in to comment.