1
0
Fork 0
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:
David Sherret 2022-06-09 19:55:04 -04:00 committed by GitHub
parent cf866c5ad3
commit 3dd981e199
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -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 {

View file

@ -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"