Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/vite_migration/src/prettier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ mod tests {
rewrite_prettier_script("prettier --check --list-different ."),
"vp fmt --check ."
);

// --list-different + --check (the other order) → still a single --check
assert_eq!(
rewrite_prettier_script("prettier --list-different --check ."),
"vp fmt --check ."
);

// two literal --check → still a single --check
assert_eq!(rewrite_prettier_script("prettier --check --check ."), "vp fmt --check .");
}

#[test]
Expand Down
9 changes: 8 additions & 1 deletion crates/vite_migration/src/script_rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,14 @@ fn strip_flags_from_suffix(
break;
}
if val == conv.dedup_flag {
conversion_emitted[ci] = true;
// Drop a duplicate if the target flag was already emitted;
// otherwise keep this one and mark it emitted.
if conversion_emitted[ci] {
converted = true;
} else {
conversion_emitted[ci] = true;
}
break;
}
}
if converted {
Expand Down
Loading