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

fix: do not format callbacks with arguments as React hooks #5778

Merged
merged 5 commits into from Jan 21, 2019

Conversation

@SimenB
Copy link
Contributor

commented Jan 20, 2019

See discussion in #5608 (comment)

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • I’ve read the contributing guidelines.

Try the playground for this PR

@SimenB SimenB referenced this pull request Jan 20, 2019
2 of 2 tasks complete
@j-f1
j-f1 approved these changes Jan 20, 2019
Copy link
Member

left a comment

Want to do a 1.16.1 @ikatyang?

@ikatyang

This comment has been minimized.

Copy link
Member

commented Jan 21, 2019

We just added a CHANGELOG.unreleased.md in #5775, could you add a changelog item in that file?

(I plan to release 1.16.1 tonight (UTC+8) if there's no more issue reported.)

@ikatyang ikatyang added this to the 1.16.1 milestone Jan 21, 2019

SimenB added 2 commits Jan 21, 2019
@SimenB

This comment has been minimized.

Copy link
Contributor Author

commented Jan 21, 2019

Sure, gave it a go!

I'm heading to bed (2:30 here), feel free to edit it if I didn't do it correctly 🙂

@j-f1 j-f1 changed the title fix: do not format functions with arguments as react hooks fix: do not format callbacks with arguments as React hooks Jan 21, 2019

@ikatyang ikatyang merged commit 5657316 into prettier:master Jan 21, 2019

6 of 8 checks passed

Header rules No header rules processed
Details
Pages changed All files already uploaded
Details
Mixed content No mixed content detected
Details
Redirect rules 3 redirect rules processed
Details
codecov/patch Coverage not affected when comparing 106fc36...fa7584d
Details
codecov/project 94.39% remains the same compared to 106fc36
Details
deploy/netlify Deploy preview ready!
Details
prettier.prettier Build #20190121.7 succeeded
Details
@ikatyang

This comment has been minimized.

Copy link
Member

commented Jan 21, 2019

Thanks!

@SimenB SimenB deleted the SimenB:react-hook-break branch Jan 21, 2019

@automatops automatops referenced this pull request Jan 22, 2019
0 of 1 task complete
@ibf-renovate ibf-renovate referenced this pull request Jan 22, 2019
0 of 1 task complete
@ikatyang

This comment has been minimized.

@SimenB

This comment has been minimized.

Copy link
Contributor Author

commented Jan 22, 2019

Thank you! Landed the upgrade in Jest as well - no changes from 1.15 🎉

@aleclarson

This comment has been minimized.

Copy link

commented Feb 4, 2019

I don't think presence of arguments is the best heuristic here.

Why not detect non-method calls with a name matching /^use[A-Z]\w*$/?

@j-f1

This comment has been minimized.

Copy link
Member

commented Feb 4, 2019

Maybe it should use the Hook style if foo((...) => { fits on one line, and break the arguments if it doesn’t.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.