Skip to content

Commit fdab22e

Browse files
committed
fix(linter/plugins): reset state after error during AST visitation
1 parent 42e9dcc commit fdab22e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export function lintFile(
6666
return JSON.stringify({ Failure: getErrorMessage(err) });
6767
} finally {
6868
diagnostics.length = 0;
69+
resetFile();
6970
}
7071
}
7172

@@ -215,8 +216,12 @@ function lintFileImpl(
215216
// Reset array, ready for next file
216217
afterHooks.length = 0;
217218
}
219+
}
218220

219-
// Reset file context, source, AST, and settings, to free memory
221+
/**
222+
* Reset file context, source, AST, and settings, to free memory.
223+
*/
224+
function resetFile() {
220225
resetFileContext();
221226
resetSourceAndAst();
222227
resetSettings();

0 commit comments

Comments
 (0)