From a7ac89935b092f86245ce0370042f4bef14ad82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 23 Sep 2024 17:01:04 +0100 Subject: 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` --- tests/integration/lsp_tests.rs | 21 ------------------ tests/specs/fmt/css/__test__.jsonc | 5 +++++ tests/specs/fmt/css/badly_formatted.css | 1 + tests/specs/fmt/html/__test__.jsonc | 5 +++++ tests/specs/fmt/html/badly_formatted.html | 9 ++++++++ tests/specs/fmt/unstable_component/__test__.jsonc | 4 ++-- tests/specs/fmt/unstable_css/__test__.jsonc | 25 ---------------------- tests/specs/fmt/unstable_css/badly_formatted.css | 1 - tests/specs/fmt/unstable_html/__test__.jsonc | 25 ---------------------- tests/specs/fmt/unstable_html/badly_formatted.html | 9 -------- tests/specs/fmt/unstable_yaml/__test__.jsonc | 25 ---------------------- tests/specs/fmt/unstable_yaml/badly_formatted.yml | 3 --- tests/specs/fmt/yaml/__test__.jsonc | 5 +++++ tests/specs/fmt/yaml/badly_formatted.yml | 3 +++ 14 files changed, 30 insertions(+), 111 deletions(-) create mode 100644 tests/specs/fmt/css/__test__.jsonc create mode 100644 tests/specs/fmt/css/badly_formatted.css create mode 100644 tests/specs/fmt/html/__test__.jsonc create mode 100644 tests/specs/fmt/html/badly_formatted.html delete mode 100644 tests/specs/fmt/unstable_css/__test__.jsonc delete mode 100644 tests/specs/fmt/unstable_css/badly_formatted.css delete mode 100644 tests/specs/fmt/unstable_html/__test__.jsonc delete mode 100644 tests/specs/fmt/unstable_html/badly_formatted.html delete mode 100644 tests/specs/fmt/unstable_yaml/__test__.jsonc delete mode 100644 tests/specs/fmt/unstable_yaml/badly_formatted.yml create mode 100644 tests/specs/fmt/yaml/__test__.jsonc create mode 100644 tests/specs/fmt/yaml/badly_formatted.yml (limited to 'tests') 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"), " "); 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/css/badly_formatted.css b/tests/specs/fmt/css/badly_formatted.css new file mode 100644 index 000000000..e57adb796 --- /dev/null +++ b/tests/specs/fmt/css/badly_formatted.css @@ -0,0 +1 @@ +#app>.btn{ color : #000 } 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/html/badly_formatted.html b/tests/specs/fmt/html/badly_formatted.html new file mode 100644 index 000000000..de7706ac7 --- /dev/null +++ b/tests/specs/fmt/html/badly_formatted.html @@ -0,0 +1,9 @@ +
content
+ + + + 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_css/badly_formatted.css b/tests/specs/fmt/unstable_css/badly_formatted.css deleted file mode 100644 index e57adb796..000000000 --- a/tests/specs/fmt/unstable_css/badly_formatted.css +++ /dev/null @@ -1 +0,0 @@ -#app>.btn{ color : #000 } 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_html/badly_formatted.html b/tests/specs/fmt/unstable_html/badly_formatted.html deleted file mode 100644 index de7706ac7..000000000 --- a/tests/specs/fmt/unstable_html/badly_formatted.html +++ /dev/null @@ -1,9 +0,0 @@ -
content
- - - - 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/unstable_yaml/badly_formatted.yml b/tests/specs/fmt/unstable_yaml/badly_formatted.yml deleted file mode 100644 index 49646f320..000000000 --- a/tests/specs/fmt/unstable_yaml/badly_formatted.yml +++ /dev/null @@ -1,3 +0,0 @@ -- Test - - Test - - Test \ 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/yaml/badly_formatted.yml b/tests/specs/fmt/yaml/badly_formatted.yml new file mode 100644 index 000000000..49646f320 --- /dev/null +++ b/tests/specs/fmt/yaml/badly_formatted.yml @@ -0,0 +1,3 @@ +- Test + - Test + - Test \ No newline at end of file -- cgit v1.2.3