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

[[Fix]] Don't warn when RegExp() is used without 'new'. #3529

Merged
merged 1 commit into from Feb 6, 2021
Merged

[[Fix]] Don't warn when RegExp() is used without 'new'. #3529

merged 1 commit into from Feb 6, 2021

Conversation

lauriro
Copy link
Contributor

@lauriro lauriro commented Feb 3, 2021

https://262.ecma-international.org/#sec-regexp-constructor
...
function call RegExp(…) is equivalent
to the object creation expression new RegExp(…)
with the same arguments
...

https://262.ecma-international.org/#sec-regexp-constructor
...
function call RegExp(…) is equivalent
to the object creation expression new RegExp(…)
with the same arguments
...
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling df7d2c1 on lauriro:fix-regexp-warn into 2d4a3d1 on jshint:master.

@jugglinmike
Copy link
Member

Thanks for the patch--this is a good idea!

It's a bit more refactoring than I'd typically like to see in a bug fix, but I'm not particularly fond of how the code is currently written, so I'll take it :)

@jugglinmike jugglinmike merged commit c18a6e4 into jshint:master Feb 6, 2021
@lauriro
Copy link
Contributor Author

lauriro commented Feb 8, 2021

It was a bit more refactoring than I would liked to do but just extending the string triggered line length error.

.. and string.indexOf would give false-positives for Arr(), Boo(), and so on.

After pull request I found that Function is also missing.

@lauriro lauriro deleted the fix-regexp-warn branch February 8, 2021 11:31
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

Successfully merging this pull request may close these issues.

None yet

3 participants