Hiding violations in Chrome Dev Console

Viewed 11262

Starting a few versions ago, Google Chrome has started showing JS violations in the developer console. While that can be useful sometimes, more often it is just cluttering the console.

Violations in dev console

Is there a way to disable these violations?

As a side note, also since recently, the developer console no longer features checkboxes for the various types of debug output. Now you only have log levels: Verbose, Info, Warnings, Errors. I find the former method with checkboxes much more useful - is there some way (a flag?) to make them come back?

4 Answers

As of Chrome 92

Using the Console UI

The console has now a left panel on which messages can be filtered by source and type, you can open the panel and select user Messages as seen below:

Filter User Messages

Downside to this approach is that once you close the panel, the filters won't be applied anymore, so if you lack of horizontal real-state on your screen, this might not be for you.

Source: https://developer.chrome.com/docs/devtools/console/reference/#browser

Using Console Message Filters

If you want to get rid of the [Violation] ... and DevTools ... messages you can filter by -/^\[Violation\]|DevTools/ (A negated RegExp) or just use -[Violation] -DevTools, apparently you can use multiple filters separated by space.

Sources:

Related