2

I am using prettier-js-mode which is great and here is my configuration:

(use-package prettier-js
  :commands (prettier-js-mode prettier)
  :init (add-hook 'js2-mode-hook 'prettier-js-mode)
  :bind (:map js2-mode-map ("M-q" . prettier))
  :config
  (setq prettier-target-mode "js2-mode")
  (setq prettier-js-args '(
    "--trailing-comma" "all"
    "--bracket-spacing" "false")))

At the moment I have to M-x and select prettier-js from the meta menu.

How could I run prettier-js after a save happens?

dagda1
  • 595
  • 1
  • 3
  • 16
  • Is the `prettier-js-mode` enabled when you open `js2-mode`? If yes it should work automatically. – Oles Savluk Sep 29 '17 at 17:44
  • 1
    `prettier-js-mode` should run `prettier` on save automatically - it is part of the mode. When you save, check your messages for any errors that may be encountered. Do you have the prettier program installed? (ie: `npm i -g prettier`) – modulitos Dec 22 '17 at 17:48

0 Answers0