Run prettier-js in buffers without filename.
- Emacs >= 27.1
- prettier-js
Download the source code and put it wherever you like and add the directory to the load path:
(add-to-list 'load-path "/path/to/prettier-js-buffer")
(require 'prettier-js-buffer)
(advice-add 'prettier-js :around #'prettier-js-buffer-or-region)
(use-package prettier-js-buffer
:straight (prettier-js-buffer
:repo "KarimAziev/prettier-js-buffer"
:type git
:host github)
:commands (prettier-js-buffer)
:hook ((web-mode
js-mode
js2-mode
typescript-mode
typescript-ts-mode
tsx-ts-mode
markdown-mode
prettier-js
json-mode)
.
prettier-js-buffer-setup)
:config
(advice-add 'prettier-js :around #'prettier-js-buffer-or-region))
Set and run prettier from project directory, if found othervise as global. With prefix arg
ask which parser to use.
Alist of allowed major modes and corresponding prettier parsers.
Alist of allowed file extensions and corresponding prettier parsers.
Regexp of directories to disable prettier setup.
List of default global args to send to prettier command.