Skip to content

Commit b071a36

Browse files
authored
fix(turbopack): downgrade duplicate binding from err to warn (#70)
1 parent 3c0fd0d commit b071a36

File tree

1 file changed

+17
-2
lines changed
  • turbopack/crates/turbopack-swc-utils/src

1 file changed

+17
-2
lines changed

turbopack/crates/turbopack-swc-utils/src/emitter.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,29 @@ impl Emitter for IssueEmitter {
123123
let severity = if is_lint {
124124
IssueSeverity::Suggestion
125125
} else {
126+
// Check if this is a duplicate binding error and downgrade to warning
127+
let is_duplicate_binding_error = message.contains("defined multiple times");
128+
126129
match level {
127130
Level::Bug => IssueSeverity::Bug,
128131
Level::Fatal | Level::PhaseFatal => IssueSeverity::Fatal,
129-
Level::Error => IssueSeverity::Error,
132+
Level::Error => {
133+
if is_duplicate_binding_error {
134+
IssueSeverity::Warning
135+
} else {
136+
IssueSeverity::Error
137+
}
138+
}
130139
Level::Warning => IssueSeverity::Warning,
131140
Level::Note => IssueSeverity::Note,
132141
Level::Help => IssueSeverity::Hint,
133-
Level::Cancelled => IssueSeverity::Error,
142+
Level::Cancelled => {
143+
if is_duplicate_binding_error {
144+
IssueSeverity::Warning
145+
} else {
146+
IssueSeverity::Error
147+
}
148+
}
134149
Level::FailureNote => IssueSeverity::Note,
135150
}
136151
};

0 commit comments

Comments
 (0)