Skip to content

Instantly share code, notes, and snippets.

@jlindsey
Last active November 9, 2016 04:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jlindsey/213b8eacd6b418f96e8dafa29c6d60f6 to your computer and use it in GitHub Desktop.
Save jlindsey/213b8eacd6b418f96e8dafa29c6d60f6 to your computer and use it in GitHub Desktop.
;; Put in dotspacemacs/user-config
(defun my/use-eslint-from-node-modules ()
(let* ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
(lambda (dir) (file-executable-p
(expand-file-name "node_modules/.bin/eslint"
dir)))))
(eslint (and root
(expand-file-name "node_modules/.bin/eslint"
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment