Skip to content

Commit 1a15529

Browse files
authored
fix: tokenizeの結果が空の場合にエラーとなる (#14)
1 parent b03b5a8 commit 1a15529

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/no-dropping-i.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ module.exports = function(context) {
2121
}
2222
const text = getSource(node);
2323
return tokenize(text).then(tokens => {
24-
tokens.reduce((prev, current) => {
24+
tokens.forEach((token, index) => {
25+
const current = token;
26+
const prev = tokens[index - 1];
27+
if (!prev || !current) {
28+
return;
29+
}
2530
if (isTargetWord(prev) && isMasuWord(current)) {
2631
report(
2732
node,
@@ -30,7 +35,6 @@ module.exports = function(context) {
3035
})
3136
);
3237
}
33-
return current;
3438
});
3539
});
3640
}

0 commit comments

Comments
 (0)