.emacs.d

My Emacs configuration files.
Log | Files | Refs | README

commit 9c8c6aded64eeef6eb41560d826c01f134edc8d3
parent 0150f3c712d0707d135e0a1617ba5f7267d0b0a4
Author: Hugo Soucy <hsoucy@kronostechnologies.com>
Date:   Wed, 21 Mar 2018 14:14:42 -0400

Add flycheck package.

Diffstat:
MREADME.md | 1+
Minit.el | 1+
Apartials/fly.el | 33+++++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -6,6 +6,7 @@ My setup for GNU Emacs. Mainly builded with * [ui.el](./partials/ui-ux.el) * [autocompletion.el](./partials/autocompletion.el) +* [fly.el](./partials/fly.el) * [backups.el](./partials/backups.el) * [charset-encoding.el](./partials/charset-encoding.el) * [custom-settings.el](./partials/custom-settings.el) diff --git a/init.el b/init.el @@ -24,6 +24,7 @@ (load-file "~/.emacs.d/partials/ui-ux.el") (load-file "~/.emacs.d/partials/autocompletion.el") +(load-file "~/.emacs.d/partials/fly.el") (load-file "~/.emacs.d/partials/backups.el") (load-file "~/.emacs.d/partials/charset-encoding.el") (load-file "~/.emacs.d/partials/custom-settings.el") diff --git a/partials/fly.el b/partials/fly.el @@ -0,0 +1,33 @@ +;; Flycheck +;; +(use-package flycheck + ;; On-the-fly syntax checking + :ensure t + :pin melpa + :config + ;; Turn on flychecking globally + (add-hook 'after-init-hook #'global-flycheck-mode) + ;; Disable jshint since we prefer eslint checking + (setq-default flycheck-disabled-checkers + (append flycheck-disabled-checkers + '(javascript-jshint))) + ;; Use eslint with web-mode for jsx files + (flycheck-add-mode 'javascript-eslint 'web-mode) + ;; Customize flycheck temp file prefix + (setq-default flycheck-temp-prefix ".flycheck") + ;; Disable json-jsonlist checking for json files + (setq-default flycheck-disabled-checkers + (append flycheck-disabled-checkers + '(json-jsonlist))) + ;; Use local eslint from node_modules before global + ;; http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable + (defun my/use-eslint-from-node-modules () + (let* ((root (locate-dominating-file + (or (buffer-file-name) default-directory) + "node_modules")) + (eslint (and root + (expand-file-name "node_modules/eslint/bin/eslint.js" + root)))) + (when (and eslint (file-executable-p eslint)) + (setq-local flycheck-javascript-eslint-executable eslint)))) + (add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules))