add prettier support
Signed-off-by: Xe <me@christine.website>
This commit is contained in:
parent
b67eb916d9
commit
1cb5489db5
|
@ -440,6 +440,34 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
add-node-modules-path = {
|
||||||
|
enable = true;
|
||||||
|
config = ''
|
||||||
|
(eval-after-load 'js2-mode
|
||||||
|
'(add-hook 'js2-mode-hook #'add-node-modules-path))
|
||||||
|
(eval-after-load 'typescript-mode
|
||||||
|
'(add-hook 'typescript-mode-hook #'add-node-modules-path))
|
||||||
|
(eval-after-load 'web-mode
|
||||||
|
'(add-hook 'web-mode-hook #'add-node-modules-path))
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
prettier-js = {
|
||||||
|
enable = true;
|
||||||
|
after = [ "xe-tools" ];
|
||||||
|
config = ''
|
||||||
|
(add-hook 'js2-mode-hook 'prettier-js-mode)
|
||||||
|
(add-hook 'web-mode-hook 'prettier-js-mode)
|
||||||
|
|
||||||
|
(add-hook 'web-mode-hook #'(lambda ()
|
||||||
|
(xe/enable-minor-mode
|
||||||
|
'("\\.jsx?\\'" . prettier-js-mode))))
|
||||||
|
(add-hook 'web-mode-hook #'(lambda ()
|
||||||
|
(xe/enable-minor-mode
|
||||||
|
'("\\.tsx?\\'" . prettier-js-mode))))
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
deno-fmt = {
|
deno-fmt = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = ''
|
config = ''
|
||||||
|
|
|
@ -10,4 +10,10 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
(insert "ಠ_ಠ"))
|
(insert "ಠ_ಠ"))
|
||||||
|
|
||||||
|
(defun xe/enable-minor-mode (my-pair)
|
||||||
|
"Enable minor mode if filename match the regexp. MY-PAIR is a cons cell (regexp . minor-mode)."
|
||||||
|
(if (buffer-file-name)
|
||||||
|
(if (string-match (car my-pair) buffer-file-name)
|
||||||
|
(funcall (cdr my-pair)))))
|
||||||
|
|
||||||
(provide 'xe-tools)
|
(provide 'xe-tools)
|
||||||
|
|
Loading…
Reference in New Issue