diff options
-rw-r--r-- | cli/args/flags.rs | 48 | ||||
-rw-r--r-- | cli/args/mod.rs | 12 | ||||
-rw-r--r-- | cli/lsp/language_server.rs | 9 | ||||
-rw-r--r-- | cli/tools/fmt.rs | 64 | ||||
-rw-r--r-- | tests/integration/lsp_tests.rs | 21 | ||||
-rw-r--r-- | tests/specs/fmt/css/__test__.jsonc | 5 | ||||
-rw-r--r-- | tests/specs/fmt/css/badly_formatted.css (renamed from tests/specs/fmt/unstable_css/badly_formatted.css) | 0 | ||||
-rw-r--r-- | tests/specs/fmt/html/__test__.jsonc | 5 | ||||
-rw-r--r-- | tests/specs/fmt/html/badly_formatted.html (renamed from tests/specs/fmt/unstable_html/badly_formatted.html) | 0 | ||||
-rw-r--r-- | tests/specs/fmt/unstable_component/__test__.jsonc | 4 | ||||
-rw-r--r-- | tests/specs/fmt/unstable_css/__test__.jsonc | 25 | ||||
-rw-r--r-- | tests/specs/fmt/unstable_html/__test__.jsonc | 25 | ||||
-rw-r--r-- | tests/specs/fmt/unstable_yaml/__test__.jsonc | 25 | ||||
-rw-r--r-- | tests/specs/fmt/yaml/__test__.jsonc | 5 | ||||
-rw-r--r-- | tests/specs/fmt/yaml/badly_formatted.yml (renamed from tests/specs/fmt/unstable_yaml/badly_formatted.yml) | 0 |
15 files changed, 39 insertions, 209 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index a5ca78acc..8490fdab6 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -206,10 +206,7 @@ pub struct FmtFlags { pub prose_wrap: Option<String>, pub no_semicolons: Option<bool>, pub watch: Option<WatchFlags>, - pub unstable_css: bool, - pub unstable_html: bool, pub unstable_component: bool, - pub unstable_yaml: bool, } impl FmtFlags { @@ -2219,7 +2216,8 @@ Ignore formatting a file by adding an ignore comment at the top of the file: .help("Enable formatting CSS, SCSS, Sass and Less files") .value_parser(FalseyValueParser::new()) .action(ArgAction::SetTrue) - .help_heading(FMT_HEADING), + .help_heading(FMT_HEADING) + .hide(true), ) .arg( Arg::new("unstable-html") @@ -2227,7 +2225,8 @@ Ignore formatting a file by adding an ignore comment at the top of the file: .help("Enable formatting HTML files") .value_parser(FalseyValueParser::new()) .action(ArgAction::SetTrue) - .help_heading(FMT_HEADING), + .help_heading(FMT_HEADING) + .hide(true), ) .arg( Arg::new("unstable-component") @@ -2243,7 +2242,8 @@ Ignore formatting a file by adding an ignore comment at the top of the file: .help("Enable formatting YAML files") .value_parser(FalseyValueParser::new()) .action(ArgAction::SetTrue) - .help_heading(FMT_HEADING), + .help_heading(FMT_HEADING) + .hide(true), ) }) } @@ -4374,10 +4374,7 @@ fn fmt_parse( let single_quote = matches.remove_one::<bool>("single-quote"); let prose_wrap = matches.remove_one::<String>("prose-wrap"); let no_semicolons = matches.remove_one::<bool>("no-semicolons"); - let unstable_css = matches.get_flag("unstable-css"); - let unstable_html = matches.get_flag("unstable-html"); let unstable_component = matches.get_flag("unstable-component"); - let unstable_yaml = matches.get_flag("unstable-yaml"); flags.subcommand = DenoSubcommand::Fmt(FmtFlags { check: matches.get_flag("check"), @@ -4389,10 +4386,7 @@ fn fmt_parse( prose_wrap, no_semicolons, watch: watch_arg_parse(matches)?, - unstable_css, - unstable_html, unstable_component, - unstable_yaml, }); Ok(()) } @@ -6272,10 +6266,7 @@ mod tests { single_quote: None, prose_wrap: None, no_semicolons: None, - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Default::default(), }), ..Flags::default() @@ -6298,10 +6289,7 @@ mod tests { single_quote: None, prose_wrap: None, no_semicolons: None, - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Default::default(), }), ..Flags::default() @@ -6324,10 +6312,7 @@ mod tests { single_quote: None, prose_wrap: None, no_semicolons: None, - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Default::default(), }), ..Flags::default() @@ -6350,10 +6335,7 @@ mod tests { single_quote: None, prose_wrap: None, no_semicolons: None, - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Some(Default::default()), }), ..Flags::default() @@ -6385,10 +6367,7 @@ mod tests { single_quote: None, prose_wrap: None, no_semicolons: None, - unstable_css: true, - unstable_html: true, unstable_component: true, - unstable_yaml: true, watch: Some(WatchFlags { hmr: false, no_clear_screen: true, @@ -6422,10 +6401,7 @@ mod tests { single_quote: None, prose_wrap: None, no_semicolons: None, - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Some(Default::default()), }), ..Flags::default() @@ -6448,10 +6424,7 @@ mod tests { single_quote: None, prose_wrap: None, no_semicolons: None, - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Default::default(), }), config_flag: ConfigFlag::Path("deno.jsonc".to_string()), @@ -6482,10 +6455,7 @@ mod tests { single_quote: None, prose_wrap: None, no_semicolons: None, - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Some(Default::default()), }), config_flag: ConfigFlag::Path("deno.jsonc".to_string()), @@ -6521,10 +6491,7 @@ mod tests { single_quote: Some(true), prose_wrap: Some("never".to_string()), no_semicolons: Some(true), - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Default::default(), }), ..Flags::default() @@ -6554,10 +6521,7 @@ mod tests { single_quote: Some(false), prose_wrap: None, no_semicolons: Some(false), - unstable_css: false, - unstable_html: false, unstable_component: false, - unstable_yaml: false, watch: Default::default(), }), ..Flags::default() diff --git a/cli/args/mod.rs b/cli/args/mod.rs index c4dda95ce..cec1b53b2 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -281,10 +281,7 @@ impl BenchOptions { #[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] pub struct UnstableFmtOptions { - pub css: bool, - pub html: bool, pub component: bool, - pub yaml: bool, } #[derive(Clone, Debug)] @@ -317,10 +314,7 @@ impl FmtOptions { Self { options: resolve_fmt_options(fmt_flags, fmt_config.options), unstable: UnstableFmtOptions { - css: unstable.css || fmt_flags.unstable_css, - html: unstable.html || fmt_flags.unstable_html, component: unstable.component || fmt_flags.unstable_component, - yaml: unstable.yaml || fmt_flags.unstable_yaml, }, files: fmt_config.files, } @@ -1301,10 +1295,7 @@ impl CliOptions { pub fn resolve_config_unstable_fmt_options(&self) -> UnstableFmtOptions { let workspace = self.workspace(); UnstableFmtOptions { - css: workspace.has_unstable("fmt-css"), - html: workspace.has_unstable("fmt-html"), component: workspace.has_unstable("fmt-component"), - yaml: workspace.has_unstable("fmt-yaml"), } } @@ -1609,10 +1600,7 @@ impl CliOptions { "sloppy-imports", "byonm", "bare-node-builtins", - "fmt-css", - "fmt-html", "fmt-component", - "fmt-yaml", ]); // add more unstable flags to the same vector holding granular flags all_valid_unstable_flags.append(&mut another_unstable_flags); diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index f8fffd292..a1cc5079d 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -1385,18 +1385,9 @@ impl Inner { .data_for_specifier(&specifier) .map(|d| &d.member_dir.workspace); let unstable_options = UnstableFmtOptions { - css: maybe_workspace - .map(|w| w.has_unstable("fmt-css")) - .unwrap_or(false), - html: maybe_workspace - .map(|w| w.has_unstable("fmt-html")) - .unwrap_or(false), component: maybe_workspace .map(|w| w.has_unstable("fmt-component")) .unwrap_or(false), - yaml: maybe_workspace - .map(|w| w.has_unstable("fmt-yaml")) - .unwrap_or(false), }; let document = document.clone(); move || { 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| { diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index f2c40f8ea..2d8d88b27 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -10597,13 +10597,6 @@ fn lsp_format_markdown() { fn lsp_format_html() { let context = TestContextBuilder::new().use_temp_cwd().build(); let temp_dir = context.temp_dir(); - temp_dir.write( - "deno.json", - json!({ - "unstable": ["fmt-html"], - }) - .to_string(), - ); let html_file = source_file(temp_dir.path().join("file.html"), " <html></html>"); let mut client = context.new_lsp_command().build(); @@ -10644,13 +10637,6 @@ fn lsp_format_html() { fn lsp_format_css() { let context = TestContextBuilder::new().use_temp_cwd().build(); let temp_dir = context.temp_dir(); - temp_dir.write( - "deno.json", - json!({ - "unstable": ["fmt-css"], - }) - .to_string(), - ); let css_file = source_file(temp_dir.path().join("file.css"), " foo {}"); let mut client = context.new_lsp_command().build(); client.initialize_default(); @@ -10690,13 +10676,6 @@ fn lsp_format_css() { fn lsp_format_yaml() { let context = TestContextBuilder::new().use_temp_cwd().build(); let temp_dir = context.temp_dir(); - temp_dir.write( - "deno.json", - json!({ - "unstable": ["fmt-yaml"], - }) - .to_string(), - ); let yaml_file = source_file(temp_dir.path().join("file.yaml"), " foo: 1"); let mut client = context.new_lsp_command().build(); client.initialize_default(); diff --git a/tests/specs/fmt/css/__test__.jsonc b/tests/specs/fmt/css/__test__.jsonc new file mode 100644 index 000000000..e58818fbe --- /dev/null +++ b/tests/specs/fmt/css/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "tempDir": true, + "args": "fmt", + "output": "[WILDLINE]badly_formatted.css\nChecked 1 file\n" +} diff --git a/tests/specs/fmt/unstable_css/badly_formatted.css b/tests/specs/fmt/css/badly_formatted.css index e57adb796..e57adb796 100644 --- a/tests/specs/fmt/unstable_css/badly_formatted.css +++ b/tests/specs/fmt/css/badly_formatted.css diff --git a/tests/specs/fmt/html/__test__.jsonc b/tests/specs/fmt/html/__test__.jsonc new file mode 100644 index 000000000..cec29d1b3 --- /dev/null +++ b/tests/specs/fmt/html/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "tempDir": true, + "args": "fmt --unstable-html", + "output": "[WILDLINE]badly_formatted.html\nChecked 1 file\n" +} diff --git a/tests/specs/fmt/unstable_html/badly_formatted.html b/tests/specs/fmt/html/badly_formatted.html index de7706ac7..de7706ac7 100644 --- a/tests/specs/fmt/unstable_html/badly_formatted.html +++ b/tests/specs/fmt/html/badly_formatted.html diff --git a/tests/specs/fmt/unstable_component/__test__.jsonc b/tests/specs/fmt/unstable_component/__test__.jsonc index a8f8697da..36057cbef 100644 --- a/tests/specs/fmt/unstable_component/__test__.jsonc +++ b/tests/specs/fmt/unstable_component/__test__.jsonc @@ -6,14 +6,14 @@ "output": "Checked 1 file\n" }, "flag": { - "args": "fmt --unstable-css --unstable-component", + "args": "fmt --unstable-component", "output": "[WILDLINE]badly_formatted.svelte\nChecked 1 file\n" }, "config_file": { "steps": [{ "args": [ "eval", - "Deno.writeTextFile('deno.json', '{\\n \"unstable\": [\"fmt-css\", \"fmt-component\"]\\n}\\n')" + "Deno.writeTextFile('deno.json', '{\\n \"unstable\": [\"fmt-component\"]\\n}\\n')" ], "output": "[WILDCARD]" }, { diff --git a/tests/specs/fmt/unstable_css/__test__.jsonc b/tests/specs/fmt/unstable_css/__test__.jsonc deleted file mode 100644 index 32259f3ae..000000000 --- a/tests/specs/fmt/unstable_css/__test__.jsonc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "tempDir": true, - "tests": { - "nothing": { - "args": "fmt", - "output": "Checked 1 file\n" - }, - "flag": { - "args": "fmt --unstable-css", - "output": "[WILDLINE]badly_formatted.css\nChecked 1 file\n" - }, - "config_file": { - "steps": [{ - "args": [ - "eval", - "Deno.writeTextFile('deno.json', '{\\n \"unstable\": [\"fmt-css\"]\\n}\\n')" - ], - "output": "[WILDCARD]" - }, { - "args": "fmt", - "output": "[WILDLINE]badly_formatted.css\nChecked 2 files\n" - }] - } - } -} diff --git a/tests/specs/fmt/unstable_html/__test__.jsonc b/tests/specs/fmt/unstable_html/__test__.jsonc deleted file mode 100644 index 2394805ad..000000000 --- a/tests/specs/fmt/unstable_html/__test__.jsonc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "tempDir": true, - "tests": { - "nothing": { - "args": "fmt", - "output": "Checked 1 file\n" - }, - "flag": { - "args": "fmt --unstable-css --unstable-html", - "output": "[WILDLINE]badly_formatted.html\nChecked 1 file\n" - }, - "config_file": { - "steps": [{ - "args": [ - "eval", - "Deno.writeTextFile('deno.json', '{\\n \"unstable\": [\"fmt-css\", \"fmt-html\"]\\n}\\n')" - ], - "output": "[WILDCARD]" - }, { - "args": "fmt", - "output": "[WILDLINE]badly_formatted.html\nChecked 2 files\n" - }] - } - } -} diff --git a/tests/specs/fmt/unstable_yaml/__test__.jsonc b/tests/specs/fmt/unstable_yaml/__test__.jsonc deleted file mode 100644 index 885db59b9..000000000 --- a/tests/specs/fmt/unstable_yaml/__test__.jsonc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "tempDir": true, - "tests": { - "nothing": { - "args": "fmt", - "output": "Checked 1 file\n" - }, - "flag": { - "args": "fmt --unstable-yaml", - "output": "[WILDLINE]badly_formatted.yml\nChecked 1 file\n" - }, - "config_file": { - "steps": [{ - "args": [ - "eval", - "Deno.writeTextFile('deno.json', '{\\n \"unstable\": [\"fmt-yaml\"]\\n}\\n')" - ], - "output": "[WILDCARD]" - }, { - "args": "fmt", - "output": "[WILDLINE]badly_formatted.yml\nChecked 2 files\n" - }] - } - } -}
\ No newline at end of file diff --git a/tests/specs/fmt/yaml/__test__.jsonc b/tests/specs/fmt/yaml/__test__.jsonc new file mode 100644 index 000000000..3cef276b8 --- /dev/null +++ b/tests/specs/fmt/yaml/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "tempDir": true, + "args": "fmt", + "output": "[WILDLINE]badly_formatted.yml\nChecked 1 file\n" +}
\ No newline at end of file diff --git a/tests/specs/fmt/unstable_yaml/badly_formatted.yml b/tests/specs/fmt/yaml/badly_formatted.yml index 49646f320..49646f320 100644 --- a/tests/specs/fmt/unstable_yaml/badly_formatted.yml +++ b/tests/specs/fmt/yaml/badly_formatted.yml |