From 38893cc42e33fc3ab5b80ef592b66226b9ba91cf Mon Sep 17 00:00:00 2001 From: mattkae Date: Sat, 11 Mar 2023 17:22:13 -0500 Subject: Using use-package everywhere, upgrade to org roam --- lisp/web.el | 54 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'lisp/web.el') diff --git a/lisp/web.el b/lisp/web.el index bb5d4f8..73f3935 100644 --- a/lisp/web.el +++ b/lisp/web.el @@ -22,17 +22,20 @@ (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) (setq-default js-indent-level 2) -(require 'flycheck) -(setq-default flycheck-disabled-checkers - (append flycheck-disabled-checkers - '(javascript-jshint))) -(setq-default flycheck-disabled-checkers - (append flycheck-disabled-checkers - '(json-jsonlist))) -(flycheck-add-mode 'javascript-eslint 'js-mode) -(flycheck-add-mode 'typescript-tslint 'typescript-mode) -(add-hook 'js-mode-hook 'flycheck-mode) -(add-hook 'typescript-mode-hook 'flycheck-mode) +(use-package flycheck + :ensure t + :config + (setq-default flycheck-disabled-checkers + (append flycheck-disabled-checkers + '(javascript-jshint))) + (setq-default flycheck-disabled-checkers + (append flycheck-disabled-checkers + '(json-jsonlist))) + (flycheck-add-mode 'javascript-eslint 'js-mode) + (flycheck-add-mode 'typescript-tslint 'typescript-mode) + (add-hook 'js-mode-hook 'flycheck-mode) + (add-hook 'typescript-mode-hook 'flycheck-mode) + ) ;; TSX (use-package tree-sitter-langs @@ -61,30 +64,29 @@ (add-hook 'flycheck-mode-hook #'my-use-eslint-from-node-modules) ;; Package management -(require 'eglot) +(use-package eglot + :config + (add-hook 'js-mode-hook 'js-eglot-ensure) + (add-hook 'typescript-mode-hook 'eglot-ensure) + (add-hook 'typescript-tsx-mode-hook 'eglot-ensure) + (add-to-list 'eglot-server-programs '(js-mode . ("typescript-language-server" "--stdio"))) + (add-to-list 'eglot-server-programs '(typescript-mode . ("typescript-language-server" "--stdio"))) + (add-to-list 'eglot-server-programs '(typescript-tsx-mode . ("typescript-language-server" "--stdio"))) + ) (defun js-eglot-ensure() "Ensure eglot mode, unless we are in json mode" (when (string= (file-name-extension buffer-file-name) "js") (eglot-ensure)) ) -(add-hook 'js-mode-hook 'js-eglot-ensure) -(add-hook 'typescript-mode-hook 'eglot-ensure) -(add-hook 'typescript-tsx-mode-hook 'eglot-ensure) -(add-to-list 'eglot-server-programs '(js-mode . ("typescript-language-server" "--stdio"))) -(add-to-list 'eglot-server-programs '(typescript-mode . ("typescript-language-server" "--stdio"))) -(add-to-list 'eglot-server-programs '(typescript-tsx-mode . ("typescript-language-server" "--stdio"))) - -;; Ignore certain directories in projectile -(require 'projectile) -(with-eval-after-load 'projectile - (add-to-list 'projectile-globally-ignored-directories "node_modules") - (add-to-list 'projectile-project-root-files "package.json")) ;; CSS eldoc (use-package css-eldoc - :commands turn-on-css-eldoc) + :ensure t + :commands turn-on-css-eldoc + :config + (add-hook 'css-mode-hook 'turn-on-css-eldoc) + ) -(add-hook 'css-mode-hook 'turn-on-css-eldoc) (provide 'web) ;;; web.el ends here -- cgit v1.2.1