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

Add parenthesis around AssignmentExpression #861

Closed
vjeux opened this issue Mar 3, 2017 · 2 comments
Closed

Add parenthesis around AssignmentExpression #861

vjeux opened this issue Mar 3, 2017 · 2 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:needs discussion Issues needing discussion and a decision to be made before action can be taken

Comments

@vjeux
Copy link
Contributor

vjeux commented Mar 3, 2017

On the react codebase, parenthesis are added around = as expression in order to show that it is not a comparison:

while ((rendered = component._renderedComponent)) {

I really like this idea.

@vjeux vjeux added the status:needs discussion Issues needing discussion and a decision to be made before action can be taken label Mar 3, 2017
vjeux added a commit to vjeux/prettier that referenced this issue Mar 3, 2017
This is a neat trick from the React codebase. It helps highlight the fact that this is an assignment and not a comparison which is subtle to realize.

Fixes prettier#861
vjeux added a commit to vjeux/prettier that referenced this issue Mar 3, 2017
This is a neat trick from the React codebase. It helps highlight the fact that this is an assignment and not a comparison which is subtle to realize.

Fixes prettier#861
@daltones
Copy link

daltones commented Mar 3, 2017

Just to enforce this, I've always wrote code this way and I guess that's a very common trick. The good old JSHint already suggested people to do this here.

Good!

@vjeux
Copy link
Contributor Author

vjeux commented Mar 3, 2017

I just sent #862 to implement it.

jlongster pushed a commit that referenced this issue Mar 3, 2017
This is a neat trick from the React codebase. It helps highlight the fact that this is an assignment and not a comparison which is subtle to realize.

Fixes #861
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 8, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:needs discussion Issues needing discussion and a decision to be made before action can be taken
Projects
None yet
Development

No branches or pull requests

2 participants