From fc32bfa4bf91f13ff3b87adbf6658a7e06eb9622 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 9 Sep 2019 11:15:54 -0400 Subject: [PATCH] Automatically enable prettier when .prettierrc is present at git root --- .emacs.d/init.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 4819a2f..c8b2414 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -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: