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

new rule: prefer cap type names #81

Merged
merged 2 commits into from
Jul 31, 2017

Conversation

DianaSuvorova
Copy link
Contributor

as per suggestion from #61

@apollo-cla
Copy link

@DianaSuvorova: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

src/index.js Outdated
@@ -210,6 +210,34 @@ export const rules = {
);
},
},
'type-names-cap': {
Copy link
Contributor

Choose a reason for hiding this comment

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

@DianaSuvorova this rule name could be more descriptive, especially for folks who don't know what cap is short for. what would you think about capitalized-type-name? (inspired by capitalized-comments from eslint)


export function typeNamesShouldBeCapitalized(context) {
return {
NamedType(node) {
Copy link
Contributor

Choose a reason for hiding this comment

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

does NamedType get called for inline fragments? i.e., can we add a test case for

query {
  someUnion {
    ... on someUnionMember {
      someField
    }
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a test.

@jnwng
Copy link
Contributor

jnwng commented Jul 30, 2017

thank you @DianaSuvorova! everything looks good, just a couple of comments to make sure the API is a little more straightforward and captures some edge cases

@DianaSuvorova
Copy link
Contributor Author

@jnwng , thanks for review! I believe I addressed all the comments. Ready for re-review 🙂

@jnwng
Copy link
Contributor

jnwng commented Jul 30, 2017

awesome, looks good. last comment — does this actually need a schema? we're not verifying it against the schema, right?

@DianaSuvorova
Copy link
Contributor Author

@jnwng , yeah I actually was thinking the same and tried the rule without providing a schema. Looks like ast parser needs it to figure out which node is NamedType. So yes schema is required for the rule.

@jnwng jnwng merged commit 363bb92 into apollographql:master Jul 31, 2017
@jnwng
Copy link
Contributor

jnwng commented Jul 31, 2017

thank you @DianaSuvorova!

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.

3 participants