Skip to content

Commit 0a42d7f

Browse files
committed
fix(tsgolint): report errors if we fail to parse tsgolint diagnostic messages (#14301)
1 parent 00dde41 commit 0a42d7f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

crates/oxc_linter/src/tsgolint.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,17 +662,16 @@ impl Iterator for TsGoLintMessageStream {
662662
let mut cursor = std::io::Cursor::new(self.buffer.as_slice());
663663

664664
if cursor.position() < self.buffer.len() as u64 {
665-
let start_pos = cursor.position();
666665
match parse_single_message(&mut cursor) {
667666
Ok(message) => {
668667
// Successfully parsed a message, remove it from buffer
669668
#[expect(clippy::cast_possible_truncation)]
670669
self.buffer.drain(..cursor.position() as usize);
671670
return Some(Ok(message));
672671
}
673-
Err(_) => {
674-
// Could not parse a complete message, need more data
675-
cursor.set_position(start_pos);
672+
Err(TsGoLintMessageParseError::IncompleteData) => {}
673+
Err(e) => {
674+
return Some(Err(e.to_string()));
676675
}
677676
}
678677
}

0 commit comments

Comments
 (0)