reactjsreact-proptypes

Is there a way to hide just the prop type errors that come in developer console - not all the errors


As part of a really large React codebase, we have added a lot of prop type check over the years.

They output a lot of errors when prop type validations fail:

enter image description here

I noticed that in the developer console, I can override the default settings to hide all the errors like below:

enter image description here

and if I do that all the normal errors and these type invalidation errors get hidden.

Is there a way I can hide only the prop-type check errors (by classifying them as some other output type) and keep getting the usual JS errors - to reduce the noise I'm getting and this also causes a lot of vertical scroll which is hard to keep up with and causes the usual console messages to lose sight of.


Solution

  • Solution

    you can use filter field provided in developer console

    enter image description here

    you can filter out error based on their content using regex, simply write -/Failed\s+prop\s+type/ in the filter field.

    Explanation

    we write regex in between // , we append it with - to indicate that don't show anything that matches the regex, \s+ is used to represent whitespace in regex.