summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index 5d33240a5..9ac9557cd 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -220,24 +220,15 @@ pub fn format_file(
}
}
-pub fn format_parsed_module(
+pub fn format_parsed_source(
parsed_source: &ParsedSource,
fmt_options: FmtOptionsConfig,
-) -> String {
- dprint_plugin_typescript::format_parsed_file(
- &dprint_plugin_typescript::SourceFileInfo {
- is_jsx: matches!(
- parsed_source.media_type(),
- deno_ast::MediaType::Jsx | deno_ast::MediaType::Tsx
- ),
- info: parsed_source.source(),
- leading_comments: parsed_source.comments().leading_map(),
- trailing_comments: parsed_source.comments().trailing_map(),
- module: parsed_source.module(),
- tokens: parsed_source.tokens(),
- },
+) -> Result<String, String> {
+ dprint_plugin_typescript::format_parsed_source(
+ parsed_source,
&get_resolved_typescript_config(&fmt_options),
)
+ .map_err(|e| e.to_string())
}
async fn check_source_files(