Add denofmt (#264)

This commit is contained in:
dalu 2023-11-30 03:25:11 +08:00 committed by GitHub
parent 56651724ad
commit c8d9ad43ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 166 additions and 0 deletions

View file

@ -13,9 +13,12 @@ The format is based on [Keep a Changelog].
([#229])
* [`robotidy`](https://robotidy.readthedocs.io) for Robot Framework files
([#263]).
* [denofmt](https://docs.deno.com/runtime/manual/tools/formatter) for
js, jsx, ts, tsx, json, jsonc, md files. ([#264])
[#229]: https://github.com/radian-software/apheleia/pull/229
[#263]: https://github.com/radian-software/apheleia/pull/263
[#264]: https://github.com/radian-software/apheleia/pull/264
## 4.0 (released 2023-11-23)
### Breaking changes

View file

@ -47,6 +47,14 @@
(apheleia-formatters-indent
"--indent-with-tabs" "--indent-size"))
(dart-format . ("dart" "format"))
(denofmt . ("deno" "fmt" "-"))
(denofmt-js . ("deno" "fmt" "-" "--ext" "js"))
(denofmt-json . ("deno" "fmt" "-" "--ext" "json"))
(denofmt-jsonc . ("deno" "fmt" "-" "--ext" "jsonc"))
(denofmt-jsx . ("deno" "fmt" "-" "--ext" "jsx"))
(denofmt-md . ("deno" "fmt" "-" "--ext" "md"))
(denofmt-ts . ("deno" "fmt" "-" "--ext" "ts"))
(denofmt-tsx . ("deno" "fmt" "-" "--ext" "tsx"))
(elm-format . ("elm-format" "--yes" "--stdin"))
(fish-indent . ("fish_indent"))
(fourmolu . ("fourmolu"))

View file

@ -0,0 +1 @@
denofmt.bash

View file

@ -0,0 +1 @@
denofmt.bash

View file

@ -0,0 +1 @@
denofmt.bash

View file

@ -0,0 +1 @@
denofmt.bash

View file

@ -0,0 +1 @@
denofmt.bash

View file

@ -0,0 +1 @@
denofmt.bash

View file

@ -0,0 +1 @@
denofmt.bash

View file

@ -0,0 +1 @@
curl -fsSL https://deno.land/x/install/install.sh | sudo DENO_INSTALL=/usr/local sh

View file

@ -0,0 +1 @@
../prettier-javascript/in.js

View file

@ -0,0 +1,5 @@
function HelloWorld(
{ greeting = "hello", greeted = '"World"', silent = false, onMouseOver },
) {
if (!greeting) return null;
}

View file

@ -0,0 +1 @@
../prettier-json/in.json

View file

@ -0,0 +1,19 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
}

View file

@ -0,0 +1,10 @@
{"arrowParens": "always",// top comment
"bracketSpacing": true,"embeddedLanguageFormatting": "auto","htmlWhitespaceSensitivity": "css","insertPragma": false,"jsxBracketSameLine": false,"jsxSingleQuote": false,"printWidth": 80,// middle comment
"proseWrap": "preserve","quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,"vueIndentScriptAndStyle": false // bottom comment
}

View file

@ -0,0 +1,19 @@
{
"arrowParens": "always", // top comment
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80, // middle comment
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false // bottom comment
}

View file

@ -0,0 +1,17 @@
const Foo = ({name,
test}
) => {
return <>
<h1>hello, {name}</h1>
<div>{test}</div>
</>
;
};
const Bar = () => {
return (
<>
<Foo name="aaa" test="bbb" />
</>
)
}

View file

@ -0,0 +1,16 @@
const Foo = ({ name, test }) => {
return (
<>
<h1>hello, {name}</h1>
<div>{test}</div>
</>
);
};
const Bar = () => {
return (
<>
<Foo name="aaa" test="bbb" />
</>
);
};

View file

@ -0,0 +1 @@
../prettier-markdown/in.md

View file

@ -0,0 +1,4 @@
| col1 | col 2 |
| ------ | ---------- |
| nice | fits |
| oh no! | it's ugly! |

View file

@ -0,0 +1 @@
../prettier-typescript/in.ts

View file

@ -0,0 +1,6 @@
interface GreetingSettings {
greeting: string;
duration?: number;
color?: string;
}
declare function greet(setting: GreetingSettings): void;

View file

@ -0,0 +1,20 @@
const Foo: FooComponent = ({
name: string,
test: number}
) => {
return <>
<h1>hello, {name}</h1>
<div>{test}</div>
</>
;
};
const Bar
: BarComponent = ()=> {
return (
<>
<Foo name="aaa"
test={1} />
</>
)
}

View file

@ -0,0 +1,19 @@
const Foo: FooComponent = ({
name: string,
test: number,
}) => {
return (
<>
<h1>hello, {name}</h1>
<div>{test}</div>
</>
);
};
const Bar: BarComponent = () => {
return (
<>
<Foo name="aaa" test={1} />
</>
);
};

View file

@ -0,0 +1 @@
../denofmt-js/in.js

View file

@ -0,0 +1 @@
../denofmt-jsx/in.jsx

View file

@ -0,0 +1 @@
../denofmt-ts/in.ts

View file

@ -0,0 +1 @@
../denofmt-tsx/in.tsx

View file

@ -0,0 +1 @@
../denofmt-js/out.js

View file

@ -0,0 +1 @@
../denofmt-jsx/out.jsx

View file

@ -0,0 +1 @@
../denofmt-ts/out.ts

View file

@ -0,0 +1 @@
../denofmt-tsx/out.tsx