Skip to content

Commit

Permalink
fix: improve undefined error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Apr 25, 2021
1 parent 31d2bc0 commit a7fc697
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/textlint-rule-max-comma.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default function (context, options = defaultOptions) {
// This `sum(0,1,2,3,4,5,6,7,8,9,10)` is ok
// → This is ok
const sentencesWithoutCode = paragraphSentenceWithoutNode
.children
.filter(node => node.type === SentenceSyntax.Sentence);
?.children
?.filter(node => node.type === SentenceSyntax.Sentence) ?? [];
sentencesWithoutCode.forEach(sentence => {
const source = new StringSource(sentence);
const sentenceValue = source.toString();
Expand Down

0 comments on commit a7fc697

Please sign in to comment.