Skip to content

Commit 9a38896

Browse files
tinovyatkingajus
authored andcommitted
fix: crash on invalid JSDoc class comment (#120)
1 parent 5bd0fb7 commit 9a38896

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/iterateJsdoc.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,14 @@ const curryUtils = (
7676

7777
if (greatGrandParentValue === 'class') {
7878
const classJsdocNode = sourceCode.getJSDocComment(greatGrandParent);
79-
const indent = _.repeat(' ', classJsdocNode.loc.start.column);
80-
const classJsdoc = parseComment(classJsdocNode, indent);
8179

82-
if (jsdocUtils.hasTag(classJsdoc, tagName)) {
83-
return true;
80+
if (classJsdocNode) {
81+
const indent = _.repeat(' ', classJsdocNode.loc.start.column);
82+
const classJsdoc = parseComment(classJsdocNode, indent);
83+
84+
if (jsdocUtils.hasTag(classJsdoc, tagName)) {
85+
return true;
86+
}
8487
}
8588
}
8689

0 commit comments

Comments
 (0)