Prettier and Spacemacs

Install prettier executable

The emacs mode requires the prettier executable to be installed. The easiest way to install prettier for me was to install it with npm global:

npm install --global prettier

Install prettier-js-mode

prettier-js is no available via Melpa, so the setup is quiet easy:

  • Open your .spacemacs (with SPC f e d)
  • Search for dotspacemacs-additional-packages
  • add prettier-js to it

Example:

dotspacemacs-additional-packages '(simpleclip prettier-js)`

Configure on-save

Search for dotspacemacs/user-config and add these two lines to it:

  (add-hook 'js2-mode-hook 'prettier-js-mode)
  (add-hook 'web-mode-hook 'prettier-js-mode)

Done

Now you can just reload your .spacemacs (SPC f e R) or restart emacs and prettier is available.

Dennis Sivia

Dennis Sivia
I am passionate about technology and especially having a lot of fun with functional programming and computer science.

Programming in Elm - Part 2 Fuzz testing

Fuzz testing might add unexpected value to your Elm project Continue reading

Programming in Elm - Part 1 Kick off

Published on July 29, 2017

Search engine relevance scoring

Published on June 17, 2017