Skip to content

Commit 6eac84a

Browse files
authored
Merge pull request #16 from shrkw/fix-nan-violation-after-line-feed
fix repoting nan violation after line feed
2 parents 663635c + 817d9d9 commit 6eac84a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/no-doubled-conjunctive-particle-ga.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function (context, options = {}) {
5555
}
5656
const current = conjunctiveParticleGaTokens[0];
5757
const sentenceIndex = source.originalIndexFromPosition(sentence.loc.start);
58-
const currentIndex = sentenceIndex + (current.word_position - 1);
58+
const currentIndex = (sentenceIndex || 0) + (current.word_position - 1);
5959
report(node, new RuleError(`文中に逆接の接続助詞 "が" が二回以上使われています。`, {
6060
index: currentIndex
6161
}));

test/no-doubled-conjunctive-particle-ga-test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,15 @@ tester.run("no-doubled-conjunctive-particle-ga", rule, {
6969
}
7070
]
7171
},
72+
{
73+
text: "\n今日は早朝から出発したが、定刻には間に合わなかったが、無事会場に到着した。",
74+
errors: [
75+
{
76+
message: `文中に逆接の接続助詞 "が" が二回以上使われています。`,
77+
line: 2,
78+
column: 12
79+
}
80+
]
81+
},
7282
]
7383
});

0 commit comments

Comments
 (0)