Skip to content

Commit 73840e0

Browse files
committed
fix(rule): support CodeBlock
1 parent d8d9b89 commit 73840e0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/textlint-rule-no-invalid-control-character.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ const reporter = (context, options = {}) => {
6161
[Syntax.Str](node) {
6262
checkNode(node);
6363
},
64+
[Syntax.CodeBlock](node) {
65+
if (checkCode) {
66+
checkNode(node);
67+
}
68+
},
6469
[Syntax.Code](node) {
6570
if (checkCode) {
6671
checkNode(node);

test/textlint-rule-no-invalid-control-character-test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ tester.run("textlint-rule-no-invalid-control-character", rule, {
6464
}
6565
]
6666
},
67+
{
68+
text: `
69+
\`\`\`
70+
var value = "\u0008"
71+
\`\`\``,
72+
options: {
73+
checkCode: true
74+
},
75+
errors: [
76+
{
77+
message: "Found invalid control character(BACKSPACE \\u0008)",
78+
index: 18
79+
}
80+
]
81+
},
6782
...invalid
6883
]
6984
});

0 commit comments

Comments
 (0)