Go to content
Blog / Tools /

How to disable ESLint rule via JavaScript comment

Having recently switched to ESLint, I often find myself googling for how to disable a rule on a particular occurrence via JavaScript comment.

Hope writing this will help me to memorize the syntax, I’ll bookmark this page otherwise 😅.

// eslint-disable-next-line no-alert
alert("foo");

alert("foo"); // eslint-disable-line no-alert

It’s also possible to omit the name of the rule, and in this case lint is turned off for the entire line.