|
|
@ -8,6 +8,7 @@ Define JavaScript language LSP Integration package. |
|
|
#+BEGIN_SRC emacs-lisp |
|
|
#+BEGIN_SRC emacs-lisp |
|
|
(use-package emacs |
|
|
(use-package emacs |
|
|
:after (uno-lang-js uno-dev-lsp projectile) |
|
|
:after (uno-lang-js uno-dev-lsp projectile) |
|
|
|
|
|
:if (executable-find "node") |
|
|
:config |
|
|
:config |
|
|
(provide 'uno-lang-js-lsp)) |
|
|
(provide 'uno-lang-js-lsp)) |
|
|
#+END_SRC |
|
|
#+END_SRC |
|
|
@ -17,6 +18,8 @@ Define JavaScript language LSP Integration package. |
|
|
#+BEGIN_SRC emacs-lisp |
|
|
#+BEGIN_SRC emacs-lisp |
|
|
(use-package emacs |
|
|
(use-package emacs |
|
|
:after uno-lang-js-lsp |
|
|
:after uno-lang-js-lsp |
|
|
|
|
|
:custom |
|
|
|
|
|
(lsp-eslint-auto-fix-on-save t) |
|
|
:init |
|
|
:init |
|
|
(require 'seq) |
|
|
(require 'seq) |
|
|
(defun uno/lang/js/lsp () |
|
|
(defun uno/lang/js/lsp () |
|
|
@ -63,6 +66,12 @@ Define JavaScript language LSP Integration package. |
|
|
(cond |
|
|
(cond |
|
|
((file-exists-p (concat -root ".yarn/")) "yarn") |
|
|
((file-exists-p (concat -root ".yarn/")) "yarn") |
|
|
((file-exists-p (concat -root "node_modules/")) "npm")))) |
|
|
((file-exists-p (concat -root "node_modules/")) "npm")))) |
|
|
|
|
|
;; https://github.com/emacs-lsp/lsp-mode/issues/1842#issuecomment-942861229 |
|
|
|
|
|
(defun uno/lang/js/lsp/eslint-autofix () |
|
|
|
|
|
"Run lsp-eslint-apply-all-fixes before lsp--before-save." |
|
|
|
|
|
(when lsp-eslint-auto-fix-on-save |
|
|
|
|
|
(lsp-eslint-fix-all))) |
|
|
|
|
|
(advice-add 'lsp--before-save :before #'uno/lang/js/lsp/eslint-autofix) |
|
|
(uno/add-useless-buffer "\\*eslint\\*") |
|
|
(uno/add-useless-buffer "\\*eslint\\*") |
|
|
(uno/add-useless-buffer "\\*eslint::.*\\*")) |
|
|
(uno/add-useless-buffer "\\*eslint::.*\\*")) |
|
|
#+END_SRC |
|
|
#+END_SRC |