Skip to content

Commit 71b98b2

Browse files
committed
fix(rule): fix reported index again
1 parent bab841e commit 71b98b2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/textlint-rule-no-unmatched-pair.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const report = context => {
3838
3939
You should close this sentence with ${contextLocation.pairMark.end}.
4040
This pair mark is called ${contextLocation.pairMark.key}.`, {
41-
index: sentenceIndex + contextLocation.index
41+
index: (sentenceIndex - node.range[0]) + contextLocation.index
4242
}));
4343
});
4444
});

test/textlint-rule-no-unmatched-pair-test.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ tester.run("textlint-rule-no-unmatched-pair", rule, {
1919
2020
また操作と表示が1対1で更新される場合、1つの操作に対して複数の箇所の表示が更新されることもあります。
2121
今回のTodoアプリでもTodoリスト(\`#js-todo-list\`)とTodoアイテム数(\`#js-todo-count\`)の2箇所を更新する必要があることからも分かります。
22-
`
22+
`, `\`Object.assign\`メソッドは、\`target\`オブジェクトに対して、1つ以上の\`sources\`オブジェクトを指定します。
23+
\`sources\`オブジェクト自身がもつ列挙可能なプロパティを第一引数の\`target\`オブジェクトに対してコピーします。
24+
\`Object.assign\`メソッドの返り値は、\`target\`オブジェクトになります。`
2325
],
2426
invalid: [
2527
{
@@ -58,9 +60,22 @@ This pair mark is called double quote.`
5860
text: `このように\`count\`変数が自動解放されずに保持できているのは「(\`increment\`)関数が外側のスコープにある(\`count\`)変数への参照を保持できる」ためです。このような性質のことをクロージャー(関数閉包)と呼びます。クロージャーは静的スコープと変数は参照され続けていればデータは保持されるという2つの性質によって成り立っています。`,
5961
errors: [
6062
{
63+
line: 1,
64+
column: 105,
6165
index: 104
6266
}
6367
]
68+
},{
69+
text: `DUMMY DUUMY.
70+
71+
72+
このように\`count\`変数が自動解放されずに保持できているのは「(\`increment\`)関数が外側のスコープにある(\`count\`)変数への参照を保持できる」ためです。このような性質のことをクロージャー(関数閉包)と呼びます。クロージャーは静的スコープと変数は参照され続けていればデータは保持されるという2つの性質によって成り立っています。`,
73+
errors: [
74+
{
75+
line: 4,
76+
column: 105
77+
}
78+
]
6479
}
6580
]
6681
});

0 commit comments

Comments
 (0)