Skip to content

Commit 2a563b5

Browse files
lilnasyoverlookmotel
authored andcommitted
refactor : remove early return
1 parent f68cd3b commit 2a563b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export const SOURCE_CODE = Object.freeze({
221221
getCommentsAfter(nodeOrToken: NodeOrToken): Comment[] {
222222
if (ast === null) initAst();
223223
const { comments } = ast;
224-
if (comments.length === 0) return [];
224+
225225
let targetEnd = nodeOrToken.end;
226226

227227
const commentsAfter: Comment[] = [];
@@ -233,7 +233,8 @@ export const SOURCE_CODE = Object.freeze({
233233
if (commentStart < targetEnd) {
234234
continue;
235235
}
236-
const whitespaceOnlyGap = whitespacePattern.test(sourceText.slice(targetEnd, commentStart));
236+
const gap = sourceText.slice(targetEnd, commentStart);
237+
const whitespaceOnlyGap = whitespacePattern.test(gap);
237238
if (whitespaceOnlyGap) {
238239
commentsAfter.push(comment);
239240
targetEnd = comment.end;

0 commit comments

Comments
 (0)