I have the following flycheck setup in my init.el
(use-package flycheck
:after web-mode
:config
(global-flycheck-mode)
(flycheck-add-mode 'javascript-eslint 'web-mode)
:diminish flycheck-mode)
Now, I expect the line (flycheck-add-mode 'javascript-eslint 'web-mode)
to add javascript-eslint as a linter whenever I have a buffer running web-mode. However,
when inside a buffer using web-mode I get the following setup:
Syntax checkers for buffer .eslintrc.js in web-mode:
No checker to run in this buffer.
Checkers that are compatible with this mode, but will not run until properly configured:
handlebars (disabled)
- may enable: Automatically disabled!
- predicate: nil
- executable: Not found
Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled checkers.
--------------------
Flycheck version: 32snapshot (package: 20191108.2129)
Emacs version: 25.2.2
System: x86_64-pc-linux-gnu
Window system: x
And if I try to manually select the syntax checker, I get:
Syntax checker in buffer .eslintrc.js in web-mode:
javascript-eslint
- major mode: `web-mode' not supported
- may enable: yes
- executable: Found at /home/mfb/src/MyFantasyBasketball/frontend/mfb-spa/node_modules/eslint/bin/eslint.js
- config file: found
Flycheck cannot use this syntax checker for this buffer.
Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled checkers.
--------------------
Flycheck version: 32snapshot (package: 20191108.2129)
Emacs version: 25.2.2
System: x86_64-pc-linux-gnu
Window system: x
Anyone have an idea what I'm missing?
P.S. For some reason my :diminish flycheck-mode
line also doesn't work...
Edit: expanded use-package command
(progn
(use-package-ensure-elpa 'flycheck
'(t)
'nil)
(defvar use-package--warning313
#'(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'flycheck keyword
(error-message-string err))))
(display-warning 'use-package msg :error))))
(condition-case-unless-debug err
(eval-after-load 'web-mode
'(if
(not
(require 'flycheck nil t))
(display-warning 'use-package
(format "Cannot load %s" 'flycheck)
:error)
(condition-case-unless-debug err
(progn
(global-flycheck-mode)
(flycheck-add-mode 'javascript-eslint 'web-mode)
(if
(fboundp 'diminish)
(diminish 'flycheck-mode))
t)
(error
(funcall use-package--warning313 :config err)))))
(error
(funcall use-package--warning313 :catch err))))
Also, I noticed it will work if I add the single line (flycheck-add-mode 'javascript-eslint 'web-mode)
to my init.el. I just can't get it to work with use-package for some reason
Edit 2: flychecker-describe-checker
output
javascript-eslint is a Flycheck syntax checker in `flycheck.el'.
This syntax checker checks syntax in the major mode(s) `web-mode', `js-mode',
`js-jsx-mode', `js2-mode', `js2-jsx-mode', `js3-mode', `rjsx-mode',
`typescript-mode'.
This syntax checker executes "eslint". The executable can be overridden with
`flycheck-javascript-eslint-executable'.
This syntax checker can be configured with these options:
* `flycheck-eslint-args'
* `flycheck-eslint-rules-directories'
Documentation:
A Javascript syntax and style checker using eslint.
See URL `https://eslint.org/'.
[back]