Skip to content

Commit

Permalink
fix(rule): fix reported index again
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Oct 20, 2018
1 parent bab841e commit 71b98b2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/textlint-rule-no-unmatched-pair.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const report = context => {
You should close this sentence with ${contextLocation.pairMark.end}.
This pair mark is called ${contextLocation.pairMark.key}.`, {
index: sentenceIndex + contextLocation.index
index: (sentenceIndex - node.range[0]) + contextLocation.index
}));
});
});
Expand Down
17 changes: 16 additions & 1 deletion test/textlint-rule-no-unmatched-pair-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ tester.run("textlint-rule-no-unmatched-pair", rule, {
また操作と表示が1対1で更新される場合、1つの操作に対して複数の箇所の表示が更新されることもあります。
今回のTodoアプリでもTodoリスト(\`#js-todo-list\`)とTodoアイテム数(\`#js-todo-count\`)の2箇所を更新する必要があることからも分かります。
`
`, `\`Object.assign\`メソッドは、\`target\`オブジェクトに対して、1つ以上の\`sources\`オブジェクトを指定します。
\`sources\`オブジェクト自身がもつ列挙可能なプロパティを第一引数の\`target\`オブジェクトに対してコピーします。
\`Object.assign\`メソッドの返り値は、\`target\`オブジェクトになります。`
],
invalid: [
{
Expand Down Expand Up @@ -58,9 +60,22 @@ This pair mark is called double quote.`
text: `このように\`count\`変数が自動解放されずに保持できているのは「(\`increment\`)関数が外側のスコープにある(\`count\`)変数への参照を保持できる」ためです。このような性質のことをクロージャー(関数閉包)と呼びます。クロージャーは静的スコープと変数は参照され続けていればデータは保持されるという2つの性質によって成り立っています。`,
errors: [
{
line: 1,
column: 105,
index: 104
}
]
},{
text: `DUMMY DUUMY.
このように\`count\`変数が自動解放されずに保持できているのは「(\`increment\`)関数が外側のスコープにある(\`count\`)変数への参照を保持できる」ためです。このような性質のことをクロージャー(関数閉包)と呼びます。クロージャーは静的スコープと変数は参照され続けていればデータは保持されるという2つの性質によって成り立っています。`,
errors: [
{
line: 4,
column: 105
}
]
}
]
});
Expand Down

0 comments on commit 71b98b2

Please sign in to comment.