Skip to content

Commit

Permalink
fix(space-around-code): インラインコードの後にスペースを強制する処理が正常に動作していない不具合を修正 (#26)
Browse files Browse the repository at this point in the history
* fix: インラインコードの前にスペースを強制する処理が正常に動作していない不具合を修正

* feat: after のみが true の場合のテストコードを追加
  • Loading branch information
book000 authored May 5, 2021
1 parent 0547e28 commit 02573de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/textlint-rule-ja-space-around-code/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function reporter(context, options) {
// InlineCodeの後に文字が存在している時のみチェック
if (existAfterChar) {
if (allowAfterSpace) {
if (afterChar !== " " && isJapaneseChar(beforeChar)) {
if (afterChar !== " " && isJapaneseChar(afterChar)) {
report(node, new RuleError("インラインコードの後にスペースを入れてください。", {
index: nodeText.length,
fix: fixer.insertTextAfterRange([0, nodeText.length], " ")
Expand Down
16 changes: 15 additions & 1 deletion packages/textlint-rule-ja-space-around-code/test/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ tester.run("InlineCode周りのスペース", rule, {
column: 10
}
]
}
},
{
text: "これは`code`おかしい",
output: "これは`code` おかしい",
options: {
before: false,
after: true
},
errors: [
{
message: "インラインコードの後にスペースを入れてください。",
index: 9
}
]
},
]
});

0 comments on commit 02573de

Please sign in to comment.