mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
feat(fmt): support formatting cjs, cts, mjs, and mts files (#14837)
This commit is contained in:
parent
cf866c5ad3
commit
3dd981e199
2 changed files with 9 additions and 2 deletions
|
@ -185,8 +185,8 @@ itest!(fmt_stdin {
|
|||
|
||||
itest!(fmt_stdin_markdown {
|
||||
args: "fmt --ext=md -",
|
||||
input: Some("# Hello Markdown\n```ts\nconsole.log( \"text\")\n```\n"),
|
||||
output_str: Some("# Hello Markdown\n\n```ts\nconsole.log(\"text\");\n```\n"),
|
||||
input: Some("# Hello Markdown\n```ts\nconsole.log( \"text\")\n```\n\n```cts\nconsole.log( 5 )\n```"),
|
||||
output_str: Some("# Hello Markdown\n\n```ts\nconsole.log(\"text\");\n```\n\n```cts\nconsole.log(5);\n```\n"),
|
||||
});
|
||||
|
||||
itest!(fmt_stdin_json {
|
||||
|
|
|
@ -194,6 +194,10 @@ fn format_markdown(
|
|||
| "tsx"
|
||||
| "js"
|
||||
| "jsx"
|
||||
| "cjs"
|
||||
| "cts"
|
||||
| "mjs"
|
||||
| "mts"
|
||||
| "javascript"
|
||||
| "typescript"
|
||||
| "json"
|
||||
|
@ -707,7 +711,10 @@ fn is_supported_ext_fmt(path: &Path) -> bool {
|
|||
| "tsx"
|
||||
| "js"
|
||||
| "jsx"
|
||||
| "cjs"
|
||||
| "cts"
|
||||
| "mjs"
|
||||
| "mts"
|
||||
| "json"
|
||||
| "jsonc"
|
||||
| "md"
|
||||
|
|
Loading…
Add table
Reference in a new issue