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: change titleCase to pascalCase #2433

Merged
merged 2 commits into from
Aug 29, 2019
Merged

Conversation

benjie
Copy link
Contributor

@benjie benjie commented Aug 23, 2019

Fixes #2396

titleCase adds spaces at word boundaries; we do not want spaces in any of these places. This PR changes titleCase usage to pascalCase to match the rest of the codebase.

$ node
> c = require('change-case')
> c.titleCase('LazyQuery')
'Lazy Query'
> c.pascalCase('LazyQuery')
'LazyQuery'
> c.pascalCase('lazy query')
'LazyQuery'
> 

(Most of the uses of titleCase currently work because they run against a single word (operationType) so no spaces are added; however keeping these opens the door to copy/paste errors so I think it's safer to eradicate titleCase.)

@@ -174,7 +174,7 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor<ReactApolloRawPlug

if (operationType === 'Query') {
const lazyOperationName: string = this.convertName(node.name.value, {
suffix: titleCase('LazyQuery'),
suffix: pascalCase('LazyQuery'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've kept this call here even though it's an expensive no-op to aid future copy-pasting. We could simplify this to:

Suggested change
suffix: pascalCase('LazyQuery'),
suffix: 'LazyQuery',

@hrg921
Copy link

hrg921 commented Aug 24, 2019

Thanks for the nice fix, I was suffering this issue.

@dotansimha dotansimha requested a review from ardatan August 27, 2019 10:28
@dotansimha
Copy link
Owner

Thank you @benjie ! This is awesome. Any chance you can rebase and resolve conflicts?

Verified

This commit was signed with the committer’s verified signature.
albertvillanova Albert Villanova del Moral
@benjie
Copy link
Contributor Author

benjie commented Aug 27, 2019

@dotansimha I’m away so I’ve attempted to do so from my phone; hopefully it’s all good but if not let me know and I can fix it from my computer next week.

@ardatan ardatan merged commit 608f1dd into dotansimha:master Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When using withHooks we seeing a space as use<queryName>Lazy Query instead of one word
4 participants