2

I tried to add this to my eslint global variable

"globals": {
    "document": false,
    "navigator": false,
    "window": false,
    "rndr": false,
    "shrd": false,
    "path": true,
    "$": false // <--- I also added this
}

but still I am getting undeclared variable or function.

Here is the flycheck verification. enter image description here

But the error is still there.

enter image description here

Please, I need some guidance how to fix this.

Thanks

zer09
  • 185
  • 2
  • 7
  • You can use comments to declare variables as global. Both `eslint` and `js2-mode` should understand them. https://eslint.org/docs/user-guide/configuring#specifying-globals –  Apr 26 '18 at 21:08
  • @DoMiNeLa10 yes it is, but you will write it on every file that use it. – zer09 Apr 27 '18 at 00:27

2 Answers2

1

If you use flycheck and js2-mode, the error is shown by js2-mode not by flycheck.

You can disable js2-mode errors by setting

  (setq js2-mode-show-parse-errors nil)
  (setq js2-mode-show-strict-warnings nil)
zer09
  • 185
  • 2
  • 7
0

You can customize js2-global-externs to your liking. It applies to every js2-mode buffer, so you won't need to duplicate your customization.

A list of any extern names you’d like to consider always declared. This list is global and is used by all ‘js2-mode’ files. You can create buffer-local externs list using ‘js2-additional-externs’.