Automatically enable prettier when .prettierrc is present at git root

This commit is contained in:
Adam Goldsmith 2019-09-09 11:15:54 -04:00
parent dd118646d1
commit fc32bfa4bf
1 changed files with 8 additions and 0 deletions

View File

@ -898,6 +898,14 @@
:config
(company-auctex-init))
(use-package prettier-js
:hook ((js2-mode typescript-mode web-mode) . prettier-js-mode-maybe)
:init
(defun prettier-js-mode-maybe ()
(interactive)
(when (file-exists-p (concat (magit-toplevel) ".prettierrc"))
(prettier-js-mode t))))
;;; Local Variables
(add-to-list 'safe-local-eval-forms '(outline-hide-body))
;; Local Variables: