Skip to content

Commit a2b9dd5

Browse files
committed
Re-order code
1 parent 86f7d5f commit a2b9dd5

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,10 @@ export const SOURCE_CODE = Object.freeze({
173173
*/
174174
getCommentsBefore(nodeOrToken: NodeOrToken): Comment[] {
175175
if (ast === null) initAst();
176-
const { comments } = ast;
177176

178-
const commentsLength = comments.length;
177+
const { comments } = ast,
178+
commentsLength = comments.length;
179+
179180
let targetStart = nodeOrToken.range[0]; // start
180181

181182
let sliceStart = commentsLength;
@@ -220,16 +221,16 @@ export const SOURCE_CODE = Object.freeze({
220221
*/
221222
getCommentsAfter(nodeOrToken: NodeOrToken): Comment[] {
222223
if (ast === null) initAst();
223-
const { comments } = ast;
224+
225+
const { comments } = ast,
226+
commentsLength = comments.length;
224227

225228
let targetEnd = nodeOrToken.range[1]; // end
226229

227230
const commentsAfter: Comment[] = [];
228-
229-
const commentsLength = comments.length;
230231
for (let i = 0; i < commentsLength; i++) {
231-
const comment = comments[i];
232-
const commentStart = comment.start;
232+
const comment = comments[i],
233+
commentStart = comment.start;
233234

234235
if (commentStart < targetEnd) {
235236
continue;
@@ -254,9 +255,10 @@ export const SOURCE_CODE = Object.freeze({
254255
*/
255256
getCommentsInside(node: Node): Comment[] {
256257
if (ast === null) initAst();
257-
const { comments } = ast;
258258

259-
const commentsLength = comments.length;
259+
const { comments } = ast,
260+
commentsLength = comments.length;
261+
260262
let indexStart: number = commentsLength;
261263
let indexEnd: number | undefined = undefined;
262264

0 commit comments

Comments
 (0)