vercel / style-guide

Vercel's engineering style guide
Mozilla Public License 2.0
1.25k stars 33 forks source link

Prevent `.` in regex #64

Open adrianbw opened 1 year ago

adrianbw commented 1 year ago

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.

mrmckeb commented 1 year ago

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

timneutkens commented 1 year ago

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