sindresorhus/eslint-plugin-unicorn

The `no-unsafe-regex` rule is annoying #153

sindresorhus posted onGitHub


// @bdougherty

posted by sindresorhus about 7 years ago

The safe-regex module also seems unmaintained, so not a great start.

For this plugin to be useful it needs to pinpoint exactly where in the regex the problem lies, and suggest how it could be fixed, ideally with --fix support.

It could maybe use regexp-tree.

posted by sindresorhus about 7 years ago

Based on what I was reading about the regexes that it's looking for (primarily http://www.regular-expressions.info/catastrophic.html), I'm not sure that there is an automated way to fix them.

But I agree that it should give some indication of what the issue is, I'm just not sure how to do that exactly. I'll mess around with it and see if I can come up with anything.

posted by bdougherty about 7 years ago

@issuehunt has funded $60.00 to this issue.


posted by IssueHuntBot almost 6 years ago

Even a trivial regular expression like /\./, which should have a star height of 0, is enough to trip the rule. It's possible it's just an incompatibility with the u flag, though.

Arguably this regexp does not need u, but there is a good reason for using u on all regexps: it disables Annex B features.

image

posted by Jessidhia over 5 years ago

safe-regex readme now says

WARNING: This module has both false positives and false negatives. Use vuln-regex-detector for improved accuracy.

Discussion on using this here: https://github.com/nodesecurity/eslint-plugin-security/issues/28

I wonder if it's possible for one eslint plugin to pull in just one rule from another plugin

posted by devinrhode2 over 5 years ago

Interestingly,

(( )?[0-9]){2}$ also raises the warning, (( )?[0-9])(( )?[0-9])$ does not. It seems to have to do with the repetition.

posted by mircowidmer about 4 years ago

@sindresorhus has rewarded $54.00 to @fisker. See it on IssueHunt

  • :moneybag: Total deposit: $60.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $6.00
posted by issuehunt-oss[bot] almost 2 years ago

Fund this Issue

$60.00
Rewarded

Rewarded pull request

Recent activities

fisker was rewarded by sindresorhus for sindresorhus/eslint-plugin-unicorn# 153
almost 2 years ago