diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-06-07 13:02:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 17:02:47 +0000 |
commit | 78774dd6647aef137b83473ab86c2f0f1a427e86 (patch) | |
tree | b9258a06968e617198517c21fd25c70df27fd4a3 /cli/tools/lint/mod.rs | |
parent | 708a6196930a1267e577805aed380e3715eaae10 (diff) |
fix: do not panic linting files with UTF-8 BOM (#24136)
Closes #24122
Diffstat (limited to 'cli/tools/lint/mod.rs')
-rw-r--r-- | cli/tools/lint/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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, }) |