Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upUnusual yoda expressions #91
Comments
This comment has been minimized.
This comment has been minimized.
|
It seems that |
feross
closed this
Apr 2, 2015
This comment has been minimized.
This comment has been minimized.
|
So @feross we think its acceptable to not allow constant expressions? That's ridiculous no? Its a perfectly valid case of something you might want? |
This comment has been minimized.
This comment has been minimized.
|
@dcousens Constant expressions are still allowed, of course :-) For example: One side effect of the "no yoda expressions" rule is that comparison expressions that always evaluate to the same thing (like {
a: true,
b: false,
c: false
} |
This comment has been minimized.
This comment has been minimized.
|
Btw, I don't actually think that preventing constant comparisons like If anything, |
This comment has been minimized.
This comment has been minimized.
|
@feross I personally don't see any difference between: I was thinking of pushing this bug upstream to eslint, just figured I'd ask here first. |
This comment has been minimized.
This comment has been minimized.
|
Ah, you're right. If |
This comment has been minimized.
This comment has been minimized.
|
@feross did we file this in |
dcousens
added
the
blocked
label
Jun 3, 2015
dcousens
reopened this
Jun 3, 2015
dcousens
self-assigned this
Jun 3, 2015
This comment has been minimized.
This comment has been minimized.
|
@dcousens I don't remember filing this on eslint. |
This comment has been minimized.
This comment has been minimized.
|
@dcousens Did you ever file this bug on eslint? |
This comment has been minimized.
This comment has been minimized.
|
@feross I haven't yet, no. |
feross
added
the
bug
label
Jun 28, 2015
This comment has been minimized.
This comment has been minimized.
|
Bug filed on eslint: eslint/eslint#2867 |
This comment has been minimized.
This comment has been minimized.
|
Bug fixed on eslint master. |
This comment has been minimized.
This comment has been minimized.
|
This is fixed in eslint 0.24.1. Run |
dcousens commentedMar 27, 2015
I recently had a case where I was using the following code in a test:
{ a: true, b: false, c: 1 > 2 }Standard blew up on me with
Expected literal to be on the right side of >.Apparently this is due to it attempting to adhere a yoda condition ruling.
Is this intentional?
I understand this is most likely a question for eslint, not standard, but I thought I'd ask first.