-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
"singleGroups" option gives spurious warnings for negative instanceof condition #2064
Comments
The "ES6" label was a finger slip, sorry about that. |
Honor expression binding power when enforcing the `singleGroups` option. Resolves jshintgh-2064
This is also the case for the |
Should we exclude 4 |return !!( window.JSON && JSON.stringify && JSON.parse );
^ Grouping operator is unnecessary for lone expressions. |
In the example you gave, this error just seems wrong. |
@Krinkle Definitely. @rwaldron is right, that is another bug. It's covered by my patch in gh-2065, but I've added another regression test to be safe. Thanks! |
Honor expression binding power when enforcing the `singleGroups` option. Resolves jshintgh-2064
Honor expression binding power when enforcing the `singleGroups` option. Resolves jshintgh-2064
Same issue here: //Warning
path.resolve(alias.dir, alias.path) + (obj.trail ? '/' + obj.trail : '');
//No warning & invalid
path.resolve(alias.dir, alias.path) + obj.trail ? '/' + obj.trail : '';
//Same as
(path.resolve(alias.dir, alias.path) + obj.trail) ? '/' + obj.trail : ''; |
Another example?
|
Honor expression binding power when enforcing the `singleGroups` option. Resolves jshintgh-2064
Also, should this trigger the warning or not? // jshint singleGroups:true
if ( (foo = 1) ) alert(1); This is usually used to indicate that the assignment was deliberate, but currently triggers a warning with the |
Honor expression binding power when enforcing the `singleGroups` option. Resolves jshintgh-2064
Honor expression binding power when enforcing the `singleGroups` option. Resolves jshintgh-2064
I still receive the warning: Warning & valid > 'foo' + ('bar' ? 'baz' : 'qux');
foobaz No warning & invalid > 'foo' + 'bar' ? 'baz' : 'qux';
baz |
Using JSHint v2.5.11, when I try the following code:
It will give out a spurious warning that "Grouping operator is unnecessary for lone expressions". It is in fact necessary, because the unary negation operator has a higher precedence than the
instanceof
operator.The text was updated successfully, but these errors were encountered: