-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
JS tokenizer fails to tokenize regular expression proceeded by boolean not operator #1915
Comments
I've had a quick look. This isn't so much an issue with the sniff, as it is an issue with the JS tokenizer. if ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {} is tokenized (correctly) as - take note of token 6/
The tokenizer gets confused when the boolean not if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {} is tokenized as:
|
gsherwood
changed the title
Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore reports on JavaScript regex pattern
JS tokenizer fails to tokenize regular expression proceeded by boolean not operator
Feb 27, 2018
@GaryJones You were right. It was the same problem as bug #1170. I needed to add an extra operator. Thanks for the report. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter
(which extendsSquiz_Sniffs_WhiteSpace_OperatorSpacingSniff
with minimal changes) complains about the lack of whitespace in a JavaScript regex pattern.Result:
I would expect this sniff/check to ignore JS regex patterns.
The text was updated successfully, but these errors were encountered: