Skip to content

Commit 4debb5e

Browse files
committed
fix: limit getAllTokens() returned elements by count
1 parent 4107be2 commit 4debb5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/oxlint/src-js/plugins/tokens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export function getTokens(
399399
sliceEnd = min(sliceEnd + afterCount, tokensLength);
400400

401401
if (typeof filter !== "function") {
402-
return tokenList.slice(sliceStart, sliceEnd);
402+
return tokenList.slice(sliceStart, min(sliceStart + (count ?? sliceEnd), sliceEnd));
403403
}
404404

405405
const allTokens: Token[] = [];

0 commit comments

Comments
 (0)