Files
creature/lisp/init-prettier.el
T
2022-10-28 01:58:31 +08:00

18 lines
513 B
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
;; -*- coding: utf-8; lexical-binding: t; -*-
(autoload 'prettier-mode "prettier" "" t)
(defun creature/prettier-setup ()
"Enable ‘prettier-mode’ selectively."
(when (and prettier-mode
(or (not prettier-version) (prettier--in-node-modules-p)))
(prettier-mode -1)))
(with-eval-after-load 'prettier
(add-hook 'prettier-mode-hook #'creature/prettier-setup))
(dolist (hook '(css-mode-hook js-mode-hook typescript-mode-hook))
(add-hook hook #'prettier-mode))
(provide 'init-prettier)