Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option relax "wrap the /regexp/ literal in parenthesis" warning #1218

Closed
jonathanong opened this issue Aug 4, 2013 · 1 comment
Closed

Comments

@jonathanong
Copy link

/[0-9]/.exec('123') throwing a warning is pretty annoying.

benesch added a commit to benesch/jshint that referenced this issue Dec 20, 2013
This warning flags any bare regexp after a return or yield statment as
ambiguous. (Example: `return /[0-9]/`.) The unnecessary fix is to wrap
the regexp in parens like so:

    return (/[0-9]/)

This is a useless warning. An unwrapped regexp following a return
statement is not ambiguous to humans or parsers. The division operator
(/) must follow an expression; a regexp literal must *not* follow an
expression. This warning flags regexp literals that appear immediately
after a return statement and thus never after an expression.

No reason to optionalize this warning, as it's not useful.

References:
  http://groups.yahoo.com/neo/groups/jslint_com/conversations/topics/345
  eslint/eslint#324
  jshint#245
  jshint#1218
@lukeapage
Copy link
Member

Fixed in #1433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants