Add formatting hook on save

This commit is contained in:
Timothy Warren 2018-07-02 13:07:39 -04:00
parent 22eeacb374
commit cef7aa4cd5
3 changed files with 24 additions and 0 deletions

View File

@ -11,3 +11,6 @@
(load-file "~/.spacemacs.d/spacemacs-init.el")
(load-file "~/.spacemacs.d/spacemacs-user-init.el")
(load-file "~/.spacemacs.d/spacemacs-user-config.el")

View File

@ -77,6 +77,8 @@ values."
dotspacemacs-additional-packages '(
all-the-icons
editorconfig
json-mode
rjsx-mode
)
;; A list of packages that cannot be updated.
dotspacemacs-frozen-packages '()

View File

@ -12,7 +12,26 @@ you should place your code here."
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
(setq neo-vc-integration '(face))
;; Use typescript mode for js/jsx too
(add-hook 'before-save-hook 'tide-format-before-save)
(setq tide-format-options
'(
:configFileName "tsconfig.prod.json"
:insertSpaceAfterFunctionKeywordForAnonymousFunctions
t
:insertSpaceBeforeFunctionParenthesis
t
:insertSpaceAfterConstructor
t
:spaceBeforeFunctionParen t
:terIndent 2
:complexity t
:no-unused-vars t
:allowJs t
:placeOpenBraceOnNewLineForFunctions nil))
;; (setq js2-basic-offset 2)
(add-to-list 'auto-mode-alist '("\\.js\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.jsx\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))