summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-09-23 17:01:04 +0100
committerGitHub <noreply@github.com>2024-09-23 18:01:04 +0200
commita7ac89935b092f86245ce0370042f4bef14ad82d (patch)
tree01a3cba6b7f83c65e0318a8e7eef69d46a7f82ed /cli/tools/fmt.rs
parentbe13da5d8d08c105e73bc966f681a02b863903d1 (diff)
feat(fmt): stabilize CSS, HTML and YAML formatters (#25753)
This commits stabilizes CSS, HTML and YAML formatters in `deno fmt`. It is no longer required to use either of these flags: - `--unstable-css` - `--unstable-html` - `--unstable-yaml` Or these `unstable` options in the config file: - `fmt-css` - `fmt-html` - `html-yaml`
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs64
1 files changed, 16 insertions, 48 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index a51a2dfc6..54713e0ec 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -285,19 +285,9 @@ fn format_markdown(
dprint_plugin_json::format_text(&fake_filename, text, &json_config)
}
"css" | "scss" | "sass" | "less" => {
- if unstable_options.css {
- format_css(&fake_filename, text, fmt_options)
- } else {
- Ok(None)
- }
- }
- "html" => {
- if unstable_options.html {
- format_html(&fake_filename, text, fmt_options)
- } else {
- Ok(None)
- }
+ format_css(&fake_filename, text, fmt_options)
}
+ "html" => format_html(&fake_filename, text, fmt_options),
"svelte" | "vue" | "astro" => {
if unstable_options.component {
format_html(&fake_filename, text, fmt_options)
@@ -305,18 +295,12 @@ fn format_markdown(
Ok(None)
}
}
- "yml" | "yaml" => {
- if unstable_options.yaml {
- pretty_yaml::format_text(
- text,
- &get_resolved_yaml_config(fmt_options),
- )
- .map(Some)
- .map_err(AnyError::from)
- } else {
- Ok(None)
- }
- }
+ "yml" | "yaml" => pretty_yaml::format_text(
+ text,
+ &get_resolved_yaml_config(fmt_options),
+ )
+ .map(Some)
+ .map_err(AnyError::from),
_ => {
let mut codeblock_config =
get_resolved_typescript_config(fmt_options);
@@ -473,19 +457,9 @@ pub fn format_file(
}
"json" | "jsonc" => format_json(file_path, file_text, fmt_options),
"css" | "scss" | "sass" | "less" => {
- if unstable_options.css {
- format_css(file_path, file_text, fmt_options)
- } else {
- Ok(None)
- }
- }
- "html" => {
- if unstable_options.html {
- format_html(file_path, file_text, fmt_options)
- } else {
- Ok(None)
- }
+ format_css(file_path, file_text, fmt_options)
}
+ "html" => format_html(file_path, file_text, fmt_options),
"svelte" | "vue" | "astro" => {
if unstable_options.component {
format_html(file_path, file_text, fmt_options)
@@ -493,18 +467,12 @@ pub fn format_file(
Ok(None)
}
}
- "yml" | "yaml" => {
- if unstable_options.yaml {
- pretty_yaml::format_text(
- file_text,
- &get_resolved_yaml_config(fmt_options),
- )
- .map(Some)
- .map_err(AnyError::from)
- } else {
- Ok(None)
- }
- }
+ "yml" | "yaml" => pretty_yaml::format_text(
+ file_text,
+ &get_resolved_yaml_config(fmt_options),
+ )
+ .map(Some)
+ .map_err(AnyError::from),
"ipynb" => dprint_plugin_jupyter::format_text(
file_text,
|file_path: &Path, file_text: String| {