-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ES6 arrow function raises unexpected operator spacing errors #1265
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
Comments
There is no much support for ES6 in general. The only features from ES6, that is correctly recognized was implemented in #1251. |
Thanks for your super fast response. That is a pity, as it's being used a lot already both in documentation and with transpilers, such as Babel. |
Not too much I guess, since you're the 2nd person asking about this in last 2 days and before nobody asked about it. The ES6 is out there for more than 1 year if I'm not mistaken. |
This just needs a new token. PHP already has one for it, so I can't see this being much of a problem. |
The commit adds the double arrow as a valid JS token. The sniff still reports an error because there is no space before the |
Cool. Thanks. |
Uh oh!
There was an error while loading. Please reload this page.
Definition of arrow function:
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions
Example ES6 Javascript:
var materialsLength3 = materials.map(material=> material.length);
Error raised :
1 | ERROR | [x] Expected 1 space before "="; 0 found
1 | ERROR | [x] Expected 1 space after "="; 0 found
1 | ERROR | [x] Equals sign not aligned correctly; expected 1 space but found 0 spaces
1 | ERROR | [x] Expected 1 space before ">"; 0 found
Expectation:
No error.
Other: File is OperatorSpacingSniff.php. In 3.0 ./src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php
The text was updated successfully, but these errors were encountered: