diff --git a/apps/oxlint/src-js/plugins/location.ts b/apps/oxlint/src-js/plugins/location.ts index 030e5dfa9d68b..be8cae69bc807 100644 --- a/apps/oxlint/src-js/plugins/location.ts +++ b/apps/oxlint/src-js/plugins/location.ts @@ -66,6 +66,12 @@ export function initLines(): void { if (sourceText === null) initSourceText(); debugAssertIsNonNull(sourceText); + // TODO: ESLint freezes `lines`, but doesn't freeze `lineStartIndices`. + // Should we freeze them? Upside is it would prevent user mutating them, but on downside would prevent us re-using + // the same arrays for multiple files. Maybe we shouldn't bother, in same way that we don't freeze the AST. + // Once we introduce lazy deserialization, presumably we'll use proxy arrays (like `NodeArray`), which will make + // them immutable by user. Maybe we can leave it until then. (@overlookmotel) + // This implementation is based on the one in ESLint. // TODO: Investigate if using `String.prototype.matchAll` is faster. // This comment is above ESLint's implementation: