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

View File

@ -898,6 +898,14 @@
:config :config
(company-auctex-init)) (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 ;;; Local Variables
(add-to-list 'safe-local-eval-forms '(outline-hide-body)) (add-to-list 'safe-local-eval-forms '(outline-hide-body))
;; Local Variables: ;; Local Variables: