Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/oxlint/src-js/plugins/comments.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* `SourceCode` methods related to comments.
*/

import { ast, initAst, sourceText } from './source_code.js';

import type { Comment, Node, NodeOrToken } from './types.ts';
Expand Down
21 changes: 8 additions & 13 deletions apps/oxlint/src-js/plugins/source_code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import { DATA_POINTER_POS_32, SOURCE_LEN_OFFSET } from '../generated/constants.j
import { deserializeProgramOnly, resetBuffer } from '../../dist/generated/deserialize.js';

import visitorKeys from '../generated/keys.js';
import {
commentsExistBetween,
getAllComments,
getCommentsAfter,
getCommentsBefore,
getCommentsInside,
} from './comments.js';
import * as commentMethods from './comments.js';
import {
getLineColumnFromOffset,
getNodeLoc,
Expand Down Expand Up @@ -164,12 +158,6 @@ export const SOURCE_CODE = Object.freeze({
return sourceText.slice(start, end);
},

getAllComments,
getCommentsBefore,
getCommentsAfter,
getCommentsInside,
commentsExistBetween,

/**
* Determine if two nodes or tokens have at least one whitespace character between them.
* Order does not matter. Returns `false` if the given nodes or tokens overlap.
Expand All @@ -183,6 +171,13 @@ export const SOURCE_CODE = Object.freeze({
throw new Error('`sourceCode.isSpaceBetween` not implemented yet'); // TODO
},

// Comment methods
getAllComments: commentMethods.getAllComments,
getCommentsBefore: commentMethods.getCommentsBefore,
getCommentsAfter: commentMethods.getCommentsAfter,
getCommentsInside: commentMethods.getCommentsInside,
commentsExistBetween: commentMethods.commentsExistBetween,

// Scope methods
isGlobalReference: scopeMethods.isGlobalReference,
getDeclaredVariables: scopeMethods.getDeclaredVariables,
Expand Down
Loading