Skip to content

Commit 02573de

Browse files
authored
fix(space-around-code): インラインコードの後にスペースを強制する処理が正常に動作していない不具合を修正 (#26)
* fix: インラインコードの前にスペースを強制する処理が正常に動作していない不具合を修正 * feat: after のみが true の場合のテストコードを追加
1 parent 0547e28 commit 02573de

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

packages/textlint-rule-ja-space-around-code/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function reporter(context, options) {
4949
// InlineCodeの後に文字が存在している時のみチェック
5050
if (existAfterChar) {
5151
if (allowAfterSpace) {
52-
if (afterChar !== " " && isJapaneseChar(beforeChar)) {
52+
if (afterChar !== " " && isJapaneseChar(afterChar)) {
5353
report(node, new RuleError("インラインコードの後にスペースを入れてください。", {
5454
index: nodeText.length,
5555
fix: fixer.insertTextAfterRange([0, nodeText.length], " ")

packages/textlint-rule-ja-space-around-code/test/index-test.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ tester.run("InlineCode周りのスペース", rule, {
9494
column: 10
9595
}
9696
]
97-
}
97+
},
98+
{
99+
text: "これは`code`おかしい",
100+
output: "これは`code` おかしい",
101+
options: {
102+
before: false,
103+
after: true
104+
},
105+
errors: [
106+
{
107+
message: "インラインコードの後にスペースを入れてください。",
108+
index: 9
109+
}
110+
]
111+
},
98112
]
99113
});

0 commit comments

Comments
 (0)