Skip to content

Instantly share code, notes, and snippets.

@imjul1an
Forked from rhalukongor/.spacemacs
Created July 28, 2017 12:35
Show Gist options
  • Save imjul1an/83646d8c147f62825e6eed1eba087110 to your computer and use it in GitHub Desktop.
Save imjul1an/83646d8c147f62825e6eed1eba087110 to your computer and use it in GitHub Desktop.
Use ESLint from project folder
(defun my/use-eslint-from-node-modules ()
(let ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
(lambda (dir)
(let ((eslint (expand-file-name "node_modules/eslint/bin/eslint.js" dir)))
(and eslint (file-executable-p eslint)))))))
(when root
(let ((eslint (expand-file-name "node_modules/eslint/bin/eslint.js" root)))
(setq-local flycheck-javascript-eslint-executable eslint)))))
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
(when (and (memq window-system '(mac ns))
(require 'exec-path-from-shell nil t))
;; (setq exec-path-from-shell-debug t)
(exec-path-from-shell-initialize)
(exec-path-from-shell-copy-envs '("LANG" "LC_ALL"))
(message "Initialized PATH and other variables from SHELL."))
(add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)
(setq js2-mode-show-parse-errors nil)
(setq js2-mode-show-strict-warnings nil)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment