5

I'm trying to setup a lint for javascript files.

Here's the relevant setup I have.

(use-package
  js2-mode
  :ensure t
  :init
  (progn

    (add-to-list 'auto-mode-alist '("\\.js?\\'" . js2-jsx-mode))
    )
  )

(use-package
  flycheck
  :ensure t
  :init
  (progn
    (add-hook 'after-init-hook #'global-flycheck-mode)
    (setq flycheck-highlighting-mode 'lines)

    ;; https://github.com/mooz/js2-mode/issues/292

    (defun setup-js2-mode ()
      (flycheck-select-checker 'javascript-eslint)
      (flycheck-mode))

    (add-hook 'js2-mode-hook #'setup-js2-mode)
    (add-hook 'js2-jsx-mode-hook #'setup-js2-mode)
    )
  )

also I know emacs can find eslint

M-: (executable-find "eslint")
"/home/eugenekim/.nvm/versions/node/v6.4.0/bin/eslint"

But I get no errors with flycheck-list-errors when I deliverately make errors on *.js files

Also I found the following weird. (not sure relevant)

M-x flycheck-select-checker (enter) javascript-eslint

Can’t use syntax checker javascript-eslint in this buffer
1
  • 1
    Did you find an answer to this? I'm guessing you need to have an esling configuration file in the directory the js file is in or something similar to configure eslint, but not yet found any details on this?
    – Tim X
    Commented Sep 17, 2017 at 5:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.