mirror of
https://github.com/vale981/apheleia
synced 2025-03-05 09:31:40 -05:00
[#21] Make Prettier respect .prettierignore
This commit is contained in:
parent
38488e0ef9
commit
3be4b486dc
2 changed files with 21 additions and 13 deletions
|
@ -3,6 +3,12 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog].
|
||||
|
||||
## Unreleased
|
||||
### Bugs fixed
|
||||
* Prettier now respects `.prettierignore` ([#21]).
|
||||
|
||||
[#21]: https://github.com/raxod502/apheleia/issues/21
|
||||
|
||||
## 1.1.1 (released 2020-07-16)
|
||||
### Formatters
|
||||
* New: [OCamlFormat](https://github.com/ocaml-ppx/ocamlformat) for
|
||||
|
|
28
apheleia.el
28
apheleia.el
|
@ -415,7 +415,7 @@ modified from what is written to disk, then don't do anything."
|
|||
(setcar command binary)))))
|
||||
(when (memq 'file command)
|
||||
(setq command (mapcar (lambda (arg)
|
||||
(if (eq arg 'file)
|
||||
(if (memq arg '(file filepath))
|
||||
(prog1 buffer-file-name
|
||||
(when (buffer-modified-p)
|
||||
(cl-return)))
|
||||
|
@ -453,7 +453,7 @@ modified from what is written to disk, then don't do anything."
|
|||
(defcustom apheleia-formatters
|
||||
'((black . ("black" "-"))
|
||||
(brittany . ("brittany" file))
|
||||
(prettier . (npx "prettier" file))
|
||||
(prettier . (npx "prettier" "--stdin-filepath" filepath))
|
||||
(gofmt . ("gofmt"))
|
||||
(ocamlformat . ("ocamlformat" file))
|
||||
(terraform . ("terraform" "fmt" "-")))
|
||||
|
@ -568,17 +568,19 @@ In Lisp code, COMMAND is similar to what you pass to
|
|||
current buffer are passed to the command on stdin, and the output
|
||||
is read from stdout. However, if you use the symbol `file' as one
|
||||
of the elements of COMMAND, then the filename of the current
|
||||
buffer is substituted for it. If you instead use the symbol
|
||||
`input' as one of the elements of COMMAND, then the contents of
|
||||
the current buffer are written to a temporary file and its name
|
||||
is substituted for `input'. Also, if you use the symbol `output'
|
||||
as one of the elements of COMMAND, then it is substituted with
|
||||
the name of a temporary file. In that case, it is expected that
|
||||
the command writes to that file, and the file is then read into
|
||||
an Emacs buffer. Finally, if you use the symbol `npx' as one of
|
||||
the elements of COMMAND, then the first string element of COMMAND
|
||||
is resolved inside node_modules/.bin if such a directory exists
|
||||
anywhere above the current `default-directory'.
|
||||
buffer is substituted for it. (Use `filepath' instead of `file'
|
||||
if you need the filename of the current buffer, but you still
|
||||
want its contents to be passed on stdin.) If you instead use the
|
||||
symbol `input' as one of the elements of COMMAND, then the
|
||||
contents of the current buffer are written to a temporary file
|
||||
and its name is substituted for `input'. Also, if you use the
|
||||
symbol `output' as one of the elements of COMMAND, then it is
|
||||
substituted with the name of a temporary file. In that case, it
|
||||
is expected that the command writes to that file, and the file is
|
||||
then read into an Emacs buffer. Finally, if you use the symbol
|
||||
`npx' as one of the elements of COMMAND, then the first string
|
||||
element of COMMAND is resolved inside node_modules/.bin if such a
|
||||
directory exists anywhere above the current `default-directory'.
|
||||
|
||||
In any case, after the formatter finishes running, the diff
|
||||
utility is invoked to determine what changes it made. That diff
|
||||
|
|
Loading…
Add table
Reference in a new issue