简体   繁体   中英

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:

在此处输入图像描述

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

在此处输入图像描述

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

you can use filter field provided in developer console

在此处输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM