Lint wpc-javascript.el

- Add Version, URL, Package-Requires sections
- Prefer `wpc-javascript-` prefix to `wpc/`
This commit is contained in:
William Carroll 2020-08-31 14:19:14 +01:00
parent 13a81435c3
commit 6267c782a0

View file

@ -1,5 +1,9 @@
;; wpc-javascript.el --- My Javascript preferences -*- lexical-binding: t -*- ;;; wpc-javascript.el --- My Javascript preferences -*- lexical-binding: t -*-
;; Author: William Carroll <wpcarro@gmail.com> ;; Author: William Carroll <wpcarro@gmail.com>
;; Version: 0.0.1
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
;; Package-Requires: ((emacs "24"))
;;; Commentary: ;;; Commentary:
;; This module hosts my Javascript tooling preferences. This also includes ;; This module hosts my Javascript tooling preferences. This also includes
@ -16,12 +20,12 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants ;; Constants
(defconst wpc/js-hooks (defconst wpc-javascript--js-hooks
'(js-mode-hook web-mode-hook typescript-mode-hook js2-mode-hook rjsx-mode-hook) '(js-mode-hook web-mode-hook typescript-mode-hook js2-mode-hook rjsx-mode-hook)
"All of the commonly used hooks for Javascript buffers.") "All of the commonly used hooks for Javascript buffers.")
(defconst wpc/frontend-hooks (defconst wpc-javascript--frontend-hooks
(-insert-at 0 'css-mode-hook wpc/js-hooks) (-insert-at 0 'css-mode-hook wpc-javascript--js-hooks)
"All of the commonly user hooks for frontend development.") "All of the commonly user hooks for frontend development.")
@ -33,7 +37,7 @@
;; Flow for Javascript ;; Flow for Javascript
(use-package add-node-modules-path (use-package add-node-modules-path
:config :config
(general-add-hook wpc/js-hooks #'add-node-modules-path)) (general-add-hook wpc-javascript--js-hooks #'add-node-modules-path))
(use-package web-mode (use-package web-mode
:mode "\\.html\\'" :mode "\\.html\\'"
@ -53,7 +57,7 @@
js2-mode-show-strict-warnings nil)) js2-mode-show-strict-warnings nil))
(progn (progn
(defun tide/setup () (defun wpc-javascript-tide-setup ()
(interactive) (interactive)
(tide-setup) (tide-setup)
(flycheck-mode 1) (flycheck-mode 1)
@ -63,19 +67,19 @@
(company-mode 1)) (company-mode 1))
(use-package tide (use-package tide
:config :config
(add-hook 'typescript-mode-hook #'tide/setup)) (add-hook 'typescript-mode-hook #'wpc-javascript-tide-setup))
(require 'web-mode) (require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
(add-hook 'web-mode-hook (add-hook 'web-mode-hook
(lambda () (lambda ()
(when (string-equal "tsx" (f-ext buffer-file-name)) (when (string-equal "tsx" (f-ext buffer-file-name))
(tide/setup)))) (wpc-javascript-tide-setup))))
(flycheck-add-mode 'typescript-tslint 'web-mode)) (flycheck-add-mode 'typescript-tslint 'web-mode))
;; JS autoformatting ;; JS autoformatting
(use-package prettier-js (use-package prettier-js
:config :config
(general-add-hook wpc/frontend-hooks #'prettier-js-mode)) (general-add-hook wpc-javascript--frontend-hooks #'prettier-js-mode))
;; Support Elm ;; Support Elm
(use-package elm-mode) (use-package elm-mode)