Skip to content

Commit 2fa8d56

Browse files
committed
fix: fix to no code error
1 parent c4f9514 commit 2fa8d56

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: src/textlint-rule-max-comma.js

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export default function (context, options = defaultOptions) {
2222
const paragraphSentenceWithoutNode = filter(paragraphSentence, (node) => {
2323
return node.type !== Syntax.Code;
2424
});
25+
if (!paragraphSentenceWithoutNode) {
26+
return;
27+
}
2528
// This `sum(0,1,2,3,4,5,6,7,8,9,10)` is ok
2629
// → This is ok
2730
const sentencesWithoutCode = paragraphSentenceWithoutNode

Diff for: test/textlint-rule-max-comma-test.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const tester = new TextLintTester();
66
// ruleName, rule, { valid, invalid }
77
tester.run("no-todo", rule, {
88
valid: [
9+
"``", // no content
910
// no match
1011
"This is text.",
1112
// 4 is ok by default

0 commit comments

Comments
 (0)