style-guide icon indicating copy to clipboard operation
style-guide copied to clipboard

Prevent `.` in regex

Open adrianbw opened this issue 1 year ago • 2 comments

Originally suggested by @timneutkens because the Next.js team will be adding it. Periods in regex tend to lead to a lot of unintentional matching, and this will help prevent performance hits from doing so.

adrianbw avatar Jun 30 '23 16:06 adrianbw

Is there an ESLint rule that can help with this? I had a look, but couldn't find one.

mrmckeb avatar Aug 29 '23 23:08 mrmckeb

I think we'll have to write one but shouldn't be too hard as regexes are a separate AST node.

CleanShot 2023-08-30 at 10 02 02@2x

timneutkens avatar Aug 30 '23 08:08 timneutkens