Search code examples
javascriptemacsspacemacsflycheck

Linting errors in js2-mode that seem to *not* be coming from flycheck?


I'm using emacs with the Spacemacs configuration (javascript layer enabled, syntax-checking not enabled). When in js2-mode I am finding that the wrong linting is happening (ie I have a .eslintrc file at my project root and its config is being ignored - running eslint from the cli gives me zero errors but errors appear in-buffer).

eslint from the cli shows no errors

I'm a bit at a loss at this point on what could even be generating these linting errors. As far as I know, they must be coming from flycheck (I note this line in the javascript layer code even though flycheck isn't mentioned in the docs nor can I find where its invoked from). However, I can swear that flycheck isn't on. I am quite sure of this because

  • I've tried manually toggling off flycheck-mode through the interactive minibuffer
  • I've run describe-mode and ensured that there's no mention of flycheck, linting, or syntax checking
  • flycheck-verify-setup reports Flycheck Mode is disabled.
  • I've added a hook (add-hook 'flycheck-mode-hook (lambda () (message "entered flycheck mode"))) that never gets triggered

So where could these errors in my buffer possibly be coming from?.

Eslint errors about missing semi colon and trailing comma

Errors show up in minibuffer

Here is a .spacemacs excerpt

 dotspacemacs-configuration-layers
 '(
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
     ;; <M-m f e R> (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     javascript
     html
     helm
     auto-completion
     git
     better-defaults
     colors
     ;; emacs-lisp
     markdown
     clojure
     ;; org
     ;; (shell :variables shell-default-position 'bottom)
     ;; spell-checking
     ;; react
     ;; syntax-checking
        version-control
     )
 ;; List of additional packages that will be installed without being
 ;; wrapped in a layer. If you need some configuration for these
 ;; packages, then consider creating a layer. You can also put the
 ;; configuration in `dotspacemacs/user-config'.
 dotspacemacs-additional-packages '(
                                                                        paredit
                                                                        editorconfig
                                                                        writeroom-mode
                                                                        tide
                                                                        csharp-mode
                                                                        elisp-format
                                                                        ;; powershell
                                                                        omnisharp
                                                                        gist
                                                                        parinfer
                                                                        ag )

Solution

  • These errors come directly from js2-mode.

    You can turn them off by setting these 2 in your config:

    (setq js2-mode-show-parse-errors nil
          js2-mode-show-strict-warnings nil)