Closed dagda1 closed 7 years ago
AFAICT the mode is called prettier-js-mode
, not prettier-mode
. Your config should be fine if you replace that.
also, the prettier
command was refactored to prettier-js-prettify, following the elisp prefixing style.
How can I configure prettier to run after a save in js2-mode?
prettier-js-mode
runs prettier-js-prettify
on save if the mode is activated. You just need to add a hook to js2. There is an example in the README.md
(add-hook 'js2-mode-hook 'prettier-js-mode)
If you want to load prettier-js with use-package, I believe you can do something like this
(use-package prettier-js
:init
(add-hook 'js2-mode-hook 'prettier-js-mode))
I hope this helps 😄
brilliant, works a treat.
You have no idea the config options I have been through to try and j2-mode or web-mode work with pure render functions without the parenthesis e.g.
const myComp = props =>
<div>foo</foo>
Now I finally have something that works.
Great work!
I'm glad you got it working! 🍻
Currently my configuration is this:
But when I hit
M-q
I get this message in the gutter:If I key
M-x
and selectprettier-js
then the code formats.But if I select
M-x
andprettier-mode
I get the autoloading error:How can I have prettier-js enabled by default and to format the code after every save?