I am trying to install this package called js2-mode. This is part of my effort to follow this tutorial.
Package documentation and tutorial are using classic installation via package-install as follows:
M-x package-install RET js2-mode RET
(require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
;; Better imenu
(add-hook 'js2-mode-hook #'js2-imenu-extras-mode)
However, I like use-package declarations to install and configure my init file. This is my attempt:
(use-package js2-mode
:ensure t
:hook ((js2-mode . js2-imenu-extras-mode))
:init
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)))
It seems to be correct. Not sure if I am missing something, though.
Is this correct? Any suggestion?