-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlang-javascript.el
63 lines (56 loc) · 2.28 KB
/
lang-javascript.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(use-package prettier-js
:config
(add-hook 'js2-mode-hook 'prettier-js-mode)
(add-hook 'web-mode-hook 'prettier-js-mode))
(use-package color-identifiers-mode
:init
(add-hook 'js2-mode-hook 'color-identifiers-mode)
(add-hook 'web-mode-hook 'color-identifiers-mode))
(use-package ac-js2
:config
(add-hook 'js2-mode-hook 'ac-js2-mode)
(add-hook 'web-mode-hook 'ac-js2-mode)
(add-to-list 'company-backends 'ac-js2-company))
(use-package smartparens
:config
(require 'smartparens-config)
(add-hook 'js-mode-hook #'smartparens-strict-mode)
(add-hook 'js2-mode-hook #'smartparens-strict-mode))
(use-package json-mode)
(use-package web-mode
:mode (("\\.html?\\'" . web-mode)
("\\.erb\\'" . web-mode)
("\\.ejs\\'" . web-mode))
:init
(require 'smartparens-config)
(require 'prettier-js)
(add-hook 'web-mode-hook 'prettier-js-mode)
;; (add-hook 'js2-mode-hook 'prettify-symbols-mode)
(setq web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2
web-mode-code-indent-offset 2
web-mode-style-padding 2
web-mode-script-padding 2))
(use-package js2-mode
:init
(setq-default tab-width 2
js2-basic-indent 2
js2-basic-offset 2
js2-auto-indent-p t
js2-cleanup-whitespace t
js2-concat-multiline-strings 'eol
js2-enter-indents-newline t
js2-indent-on-enter-key t
indent-tabs-mode nil
js2-global-externs (list "window" "module" "require" "buster" "sinon" "assert" "refute"
"setTimeout" "clearTimeout" "setInterval" "clearInterval" "location"
"__dirname" "console" "JSON" "jQuery" "$")
js2-strict-trailing-comma-warning t
js2-strict-inconsistent-return-warning nil
js2-strict-missing-semi-warning nil)
:config
(add-hook 'js-mode-hook 'js2-minor-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-hook 'js2-mode-hook
(lambda () (flycheck-select-checker "javascript-eslint"))))
(provide 'lang-javascript)