mirror of
https://github.com/denoland/deno.git
synced 2025-01-22 06:09:25 -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 {
|
itest!(fmt_stdin_markdown {
|
||||||
args: "fmt --ext=md -",
|
args: "fmt --ext=md -",
|
||||||
input: Some("# Hello Markdown\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"),
|
output_str: Some("# Hello Markdown\n\n```ts\nconsole.log(\"text\");\n```\n\n```cts\nconsole.log(5);\n```\n"),
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(fmt_stdin_json {
|
itest!(fmt_stdin_json {
|
||||||
|
|
|
@ -194,6 +194,10 @@ fn format_markdown(
|
||||||
| "tsx"
|
| "tsx"
|
||||||
| "js"
|
| "js"
|
||||||
| "jsx"
|
| "jsx"
|
||||||
|
| "cjs"
|
||||||
|
| "cts"
|
||||||
|
| "mjs"
|
||||||
|
| "mts"
|
||||||
| "javascript"
|
| "javascript"
|
||||||
| "typescript"
|
| "typescript"
|
||||||
| "json"
|
| "json"
|
||||||
|
@ -707,7 +711,10 @@ fn is_supported_ext_fmt(path: &Path) -> bool {
|
||||||
| "tsx"
|
| "tsx"
|
||||||
| "js"
|
| "js"
|
||||||
| "jsx"
|
| "jsx"
|
||||||
|
| "cjs"
|
||||||
|
| "cts"
|
||||||
| "mjs"
|
| "mjs"
|
||||||
|
| "mts"
|
||||||
| "json"
|
| "json"
|
||||||
| "jsonc"
|
| "jsonc"
|
||||||
| "md"
|
| "md"
|
||||||
|
|
Loading…
Add table
Reference in a new issue