Skip to content

Commit a7fc697

Browse files
committed
fix: improve undefined error handling
1 parent 31d2bc0 commit a7fc697

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/textlint-rule-max-comma.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export default function (context, options = defaultOptions) {
2828
// This `sum(0,1,2,3,4,5,6,7,8,9,10)` is ok
2929
// → This is ok
3030
const sentencesWithoutCode = paragraphSentenceWithoutNode
31-
.children
32-
.filter(node => node.type === SentenceSyntax.Sentence);
31+
?.children
32+
?.filter(node => node.type === SentenceSyntax.Sentence) ?? [];
3333
sentencesWithoutCode.forEach(sentence => {
3434
const source = new StringSource(sentence);
3535
const sentenceValue = source.toString();

0 commit comments

Comments
 (0)