Skip to content

Commit

Permalink
Merge branch 'main' into prettier-json-stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpza authored Jan 18, 2025
2 parents 0df4649 + fa50cb3 commit 3db5468
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ The format is based on [Keep a Changelog].
## Unreleased
### Formatters
* `prettier-json-stringify` ([#183]).
* `biome` ([#339]).

[#183]: https://github.com/radian-software/apheleia/pull/183
[#339]: https://github.com/radian-software/apheleia/pull/339

## 4.3 (released 2024-11-12)
### Features
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ checkdoc: ## Check for missing or poorly formatted docstrings
--eval "(or (fboundp 'checkdoc-file) (kill-emacs))" \
--eval "(setq sentence-end-double-space nil)" \
--eval "(checkdoc-file \"$$file\")" 2>&1 \
| (grep -v "Warning (emacs): \\?$$" ||:) \
| (grep -v "Some lines are over 80 columns wide" ||:) \
| grep . && exit 1 || true ;\
done

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The approach is as follows:
has finished running, check if the buffer has been modified since
it started; only apply the changes if not.
2. After running the code formatter, generate an [RCS
patch](https://tools.ietf.org/doc/tcllib/html/rcs.html#section4)
patch](https://web.archive.org/web/20220527003730/https://tools.ietf.org/doc/tcllib/html/rcs.html#section4)
showing the changes and then apply it to the buffer. This prevents
changes elsewhere in the buffer from moving point. If a patch
region happens to include point, then use a [dynamic programming
Expand Down
3 changes: 2 additions & 1 deletion apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"-"))
(brittany . ("brittany"))
(buildifier . ("buildifier"))
(biome . ("apheleia-npx" "biome" "format" "--stdin-file-path" filepath))
(caddyfmt . ("caddy" "fmt" "-"))
(clang-format . ("clang-format"
"-assume-filename"
Expand Down Expand Up @@ -1181,7 +1182,7 @@ For more implementation detail, see
(setq-local indent-line-function
(buffer-local-value 'indent-line-function buffer))
(setq-local lisp-indent-function
(buffer-local-value 'lisp-indent-function buffer))
(buffer-local-value 'lisp-indent-function buffer))
(setq-local indent-tabs-mode
(buffer-local-value 'indent-tabs-mode buffer))
(goto-char (point-min))
Expand Down
6 changes: 5 additions & 1 deletion apheleia-rcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ the following keys:
- `lines': number of lines to be inserted or removed
- `text': the string to be inserted, only for `addition'
See <https://tools.ietf.org/doc/tcllib/html/rcs.html#section4>
See <https://web.archive.org/web/20220527003730/https://tools.ietf.org/doc/tcllib/html/rcs.html#section4>
for documentation on the RCS patch format."
(save-excursion
(goto-char (point-min))
Expand Down Expand Up @@ -206,3 +206,7 @@ contains the patch."
(provide 'apheleia-rcs)

;;; apheleia-rcs.el ends here

;; Local Variables:
;; byte-compile-docstring-max-column: 160
;; End:
1 change: 1 addition & 0 deletions test/formatters/installers/biome.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm install -g @biomejs/biome
13 changes: 13 additions & 0 deletions test/formatters/samplecode/biome/in.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
body

{
padding-left : 11em;
font-family
: Georgia,

"Times New Roman",
Times, serif;
color: purple;
background-color:
#d8da3d
}
1 change: 1 addition & 0 deletions test/formatters/samplecode/biome/in.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{human(id: "1000") {name height(unit: FOOT)}}
4 changes: 4 additions & 0 deletions test/formatters/samplecode/biome/in.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function HelloWorld({greeting = "hello", greeted = '"World"', silent = false, onMouseOver,}) {

if(!greeting){return null};
}
1 change: 1 addition & 0 deletions test/formatters/samplecode/biome/in.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"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}
1 change: 1 addition & 0 deletions test/formatters/samplecode/biome/in.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
interface GreetingSettings{greeting: string; duration?: number; color?: string;}declare function greet(setting: GreetingSettings): void;
6 changes: 6 additions & 0 deletions test/formatters/samplecode/biome/out.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body {
padding-left: 11em;
font-family: Georgia, "Times New Roman", Times, serif;
color: purple;
background-color: #d8da3d;
}
6 changes: 6 additions & 0 deletions test/formatters/samplecode/biome/out.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
human(id: "1000") {
name
height(unit: FOOT)
}
}
10 changes: 10 additions & 0 deletions test/formatters/samplecode/biome/out.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function HelloWorld({
greeting = "hello",
greeted = '"World"',
silent = false,
onMouseOver,
}) {
if (!greeting) {
return null;
}
}
19 changes: 19 additions & 0 deletions test/formatters/samplecode/biome/out.json
Original file line number Diff line number Diff line change
@@ -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
}
6 changes: 6 additions & 0 deletions test/formatters/samplecode/biome/out.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface GreetingSettings {
greeting: string;
duration?: number;
color?: string;
}
declare function greet(setting: GreetingSettings): void;

0 comments on commit 3db5468

Please sign in to comment.