From 78774dd6647aef137b83473ab86c2f0f1a427e86 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 7 Jun 2024 13:02:47 -0400 Subject: fix: do not panic linting files with UTF-8 BOM (#24136) Closes #24122 --- cli/tools/lint/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/tools/lint/mod.rs b/cli/tools/lint/mod.rs index 151d0f11d..712b95e34 100644 --- a/cli/tools/lint/mod.rs +++ b/cli/tools/lint/mod.rs @@ -230,7 +230,7 @@ async fn lint_files( deno_core::unsync::spawn(async move { run_parallelized(paths, { move |file_path| { - let file_text = fs::read_to_string(&file_path)?; + let file_text = deno_ast::strip_bom(fs::read_to_string(&file_path)?); // don't bother rechecking this file if it didn't have any diagnostics before if incremental_cache.is_file_same(&file_path, &file_text) { @@ -510,7 +510,7 @@ fn lint_stdin( linter .lint_file(LintFileOptions { specifier: specifier_from_file_path(file_path)?, - source_code: source_code.clone(), + source_code: deno_ast::strip_bom(source_code), media_type: MediaType::TypeScript, config, }) -- cgit v1.2.3