Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Intellij IDEA handle global JS variables defined in ESLint config

I define some global variables in my project's .eslintrc, and this config file is detected correctly by ESLint when I run ESLint as a script.

Now, I would like to configure IntelliJ IDEA so that its JavaScript inspector notices that I have defined these global variables in .eslintrc, and doesn't bother me with "Missing import statement" warnings for these variables.

For example, both ReactDOM and React are global variables defined in my .eslintrc, so I would like the warnings in this screenshot to disappear:

Missing import statement screenshot

FYI, the JavaScript language version selected in the project settings is "React JSX (JSX in ECMAScript 6)".

As far as I know, ESlint is configured correctly in the settings:

IntelliJ IDEA Settings screenshot

What am I missing?

(I am using the currently latest version of IntelliJ IDEA: 2016.3.4)

like image 838
Blackbird Avatar asked Oct 20 '25 01:10

Blackbird


1 Answers

ESLint configuration doesn't affect IDEA own inspections; you need to suppress 'Missing Import statement' inspection using Alt+Enter, Right, 'Suppress for statement';

there is a feature request to respect env and globals from .eslintrc - see https://youtrack.jetbrains.com/issue/WEB-21957

like image 78
lena Avatar answered Oct 22 '25 14:10

lena



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!