Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different highlight style for ESLint errors in WebStorm

I'm using WebStorm 2017.3 and ESLint.

I'm wondering: is there a way to customize ESLint errors highlighting so I will be able to distinguish the WebStorm's errors (there is no closing bracket) and ESLint 'errors' (there should be a space before the bracket)?

Currently, I can not distinguish critical typos and 'advices' of ESLint.

like image 758
Anton Y. Avatar asked Dec 12 '17 09:12

Anton Y.


People also ask

How do I fix ESLint errors in WebStorm?

Open the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Languages & Frameworks | JavaScript | Code Quality Tools | ESLint, and select the Run eslint --fix on save checkbox.

How do you fix ESLint errors?

There are three ways that ESLint fix can be run: eslint --fix. eslint --fix-dry-run. eslint --fix --fix-type.

Does WebStorm have Linter?

WebStorm integrates with ESLint and other most popular JavaScript code linters that detect problems in your code without executing it. When installed and enabled, a linter activates automatically every time you open a JavaScript file, reports detected errors and warnings, and suggests quick-fixes where possible.


2 Answers

In File | Settings | Editor | Inspections, select ESLint

Uncheck in Options: use rule severity from the configuration file

From the Severity dropdown, choose the desired severity level, or select Edit severities and set up your own severity level with desired highlighting

enter image description here

like image 63
InsOp Avatar answered Oct 10 '22 19:10

InsOp


'Custom' severity highlighting is not supported for ESLint - WEB-25697. Level 1 issues (https://eslint.org/docs/user-guide/configuring#configuring-rules) are highlighted as warnings ( Settings | Editor | Color Scheme | General | Errors and Warnings | Warning), Level 2 - as errors (Settings | Editor | Color Scheme | General | Errors and Warnings | Error)

Update: since 2018.3, you can override severity levels from the linter's config by unchecking Use rule severity from the configuration file in Preferences | Editor | Inspections | ESLint. Please note that this way all rules enabled in the config will be highlighted the same way, without the distinction between errors and warnings. See this comment: https://youtrack.jetbrains.com/issue/WEB-25697#focus=streamItem-27-3090927.0-0

like image 41
lena Avatar answered Oct 10 '22 21:10

lena