Use js2-mode for additional Node.js extensions.

Node.js can file extensions to force ECMAScript (.mjs) versus
CommonJS (.cjs) module systems. They're both JavaScript files so use
js2-mode when editing them.
This commit is contained in:
Byron Clark 2023-04-14 13:06:17 -06:00 committed by Bozhidar Batsov
parent ce86286127
commit b57ff48e09
2 changed files with 5 additions and 3 deletions

View file

@ -23,6 +23,7 @@
* The keybinding for `proced` is now enabled unconditionally.
* Replace prelude-go backend with `lsp` instead of unmaintained tools.
* Use `rust-analyzer` as language server for prelude-rust and provide nicer syntax highlighting with `tree-sitter`.
* Use `js2-mode` for Node.js specific `.cjs` and `.mjs` extensions.
### Bugs fixed

View file

@ -35,9 +35,10 @@
(require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.[cm]js\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
(with-eval-after-load 'js2-mode
(defun prelude-js-mode-defaults ()