Skip to content

feat(fmt): remove UTF-8 BOM instead of maintaining it #29796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kingsword09
Copy link

closes: #29790

@bartlomieju bartlomieju requested a review from dsherret June 18, 2025 07:55
cli/tools/fmt.rs Outdated

Ok(FileContents { text, had_bom })
Ok(text)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might need to still track when the file had a bom so that we can always overwrite that file to not have a bom.

.with_context(|| {
anyhow!("{} is not a valid UTF-8 file", file_path.display())
})?;
let text = deno_media_type::encoding::decode_owned_source(
Copy link
Member

@dsherret dsherret Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kingsword09
Copy link
Author

I have restored the FileContents struct as suggested. Please help review if this is the correct modification. Thank you!

@kingsword09 kingsword09 force-pushed the feat-fmt-remove-utf8-bom branch from 566f981 to 5e09624 Compare June 18, 2025 15:56
@dsherret dsherret self-requested a review June 18, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deno fmt - remove UTF-8 BOM instead of maintaining it
2 participants