summaryrefslogtreecommitdiff
path: root/cli/tools
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools')
-rw-r--r--cli/tools/fmt.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index 81af25c34..837883561 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -353,6 +353,21 @@ fn format_yaml(
file_text: &str,
fmt_options: &FmtOptionsConfig,
) -> Result<Option<String>, AnyError> {
+ let ignore_file = file_text
+ .lines()
+ .take_while(|line| line.starts_with('#'))
+ .any(|line| {
+ line
+ .strip_prefix('#')
+ .unwrap()
+ .trim()
+ .starts_with("deno-fmt-ignore-file")
+ });
+
+ if ignore_file {
+ return Ok(None);
+ }
+
let formatted_str =
pretty_yaml::format_text(file_text, &get_resolved_yaml_config(fmt_options))
.map_err(AnyError::from)?;