Intelligently disable ESLint rules for VS Code.
- Place the cursor on the problem line at any position.
- Press
ctrl + alt + d
to insert// eslint-disable-next-line "explicit rule(s)"
.
For multiple lines, it inserts block comments:
/* eslint-disable no-console */
console.log('hello')
console.log('world')
/* eslint-enable no-console */
Tip
For multiple lines, you don't need to select the full text of lines. Just ensure the selection ranges cover the problem lines.
ctrl + alt + e
: disable rule(s) of line(s) for entire file.ctrl + alt + a
: disable all rule(s) for entire file.
The official ESLint extension has few steps to disable rules as:
- Place cursor on the problem line - (It doesn't support for multiple lines.).
- Press
ctrl + .
to open the Quick Fix menu. - Select which rule to disable - (It doesn't support for multiple rules).
With this ext, you can disable multiple rules for multiple lines with one step.
Single line.
Multiple lines, you can press ctrl + d
to select another pair of rule(s) on the other side.