Skip to content

Commit e85812b

Browse files
committed
Generally prefer js-mode to js2-mode, but use js2-minor-mode as a linter
1 parent 075b9e8 commit e85812b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lisp/init-javascript.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
;; Need to first remove from list if present, since elpa adds entries too, which
1111
;; may be in an arbitrary order
1212

13-
(add-to-list 'auto-mode-alist '("\\.\\(js\\|es6\\)\\(\\.erb\\)?\\'" . js2-mode))
13+
(add-to-list 'auto-mode-alist '("\\.\\(js\\|es6\\)\\(\\.erb\\)?\\'" . js-mode))
1414

1515
;; js2-mode
1616

@@ -25,7 +25,10 @@
2525
(defun sanityinc/enable-js2-checks-if-flycheck-inactive ()
2626
(unless (flycheck-get-checker-for-buffer)
2727
(setq-local js2-mode-show-parse-errors t)
28-
(setq-local js2-mode-show-strict-warnings t)))
28+
(setq-local js2-mode-show-strict-warnings t)
29+
(when (derived-mode-p 'js-mode)
30+
(js2-minor-mode 1))))
31+
(add-hook 'js-mode-hook 'sanityinc/enable-js2-checks-if-flycheck-inactive)
2932
(add-hook 'js2-mode-hook 'sanityinc/enable-js2-checks-if-flycheck-inactive)
3033

3134
(add-hook 'js2-mode-hook (lambda () (setq mode-name "JS2")))

0 commit comments

Comments
 (0)