Skip to content

Commit b402024

Browse files
committed
refactor(linter/plugins): rename function (#14726)
Trivial change. Rename this function to better describe what it does.
1 parent 3029dfb commit b402024

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { diagnostics, setupContextForFile } from './context.js';
22
import { registeredRules } from './load.js';
3-
import { ast, initAst, resetSource, setupSourceForFile } from './source_code.js';
3+
import { ast, initAst, resetSourceAndAst, setupSourceForFile } from './source_code.js';
44
import { assertIs, getErrorMessage } from './utils.js';
55
import { addVisitorToCompiled, compiledVisitor, finalizeCompiledVisitor, initCompiledVisitor } from './visitor.js';
66

@@ -160,6 +160,6 @@ function lintFileImpl(filePath: string, bufferId: number, buffer: Uint8Array | n
160160
afterHooks.length = 0;
161161
}
162162

163-
// Reset source, to free memory
164-
resetSource();
163+
// Reset source and AST, to free memory
164+
resetSourceAndAst();
165165
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function initAst(): void {
6565
}
6666

6767
/**
68-
* Reset source after file has been linted, to free memory.
68+
* Reset source and AST after file has been linted, to free memory.
6969
*
7070
* Setting `buffer` to `null` also prevents AST being deserialized after linting,
7171
* at which point the buffer may be being reused for another file.
@@ -74,7 +74,7 @@ export function initAst(): void {
7474
* With `buffer` set to `null`, accessing `SOURCE_CODE.ast` will still throw, but the error message will be clearer,
7575
* and no danger of an infinite loop due to a circular AST (unlikely but possible).
7676
*/
77-
export function resetSource(): void {
77+
export function resetSourceAndAst(): void {
7878
buffer = null;
7979
sourceText = null;
8080
ast = null;

0 commit comments

Comments
 (0)