diff --git a/apps/oxlint/src-js/plugins/lint.ts b/apps/oxlint/src-js/plugins/lint.ts index 42666c1cd051b..c7990cd933427 100644 --- a/apps/oxlint/src-js/plugins/lint.ts +++ b/apps/oxlint/src-js/plugins/lint.ts @@ -66,6 +66,7 @@ export function lintFile( return JSON.stringify({ Failure: getErrorMessage(err) }); } finally { diagnostics.length = 0; + resetFile(); } } @@ -215,8 +216,12 @@ function lintFileImpl( // Reset array, ready for next file afterHooks.length = 0; } +} - // Reset file context, source, AST, and settings, to free memory +/** + * Reset file context, source, AST, and settings, to free memory. + */ +function resetFile() { resetFileContext(); resetSourceAndAst(); resetSettings();