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 compiled graphql relay to be considered generated #4118

Merged

Conversation

vkmita
Copy link
Contributor

@vkmita vkmita commented Apr 27, 2018

Marking .graphql.js files which are generated by GraphQL relay-compiler as generated.

Checklist:

  • I am adding new or changing current functionality
    • I have added or updated the tests for the new or changed functionality.

#
# Return true or false
def generated_graphql_relay_js?
!!name.match(/__generated__\/[_A-Za-z][_0-9A-Za-z]+\.graphql\.js$/)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we mark the whole __generated__ directory as generated?

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 was going the safer route and only marking the files (.graphql.js) I know relay-compiler is generating, but the directory name is __generated__...

If you think that marking everything within any __generated__ directory is safe, I can make the change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't the __generated__ directory created by relay-compiler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd probably mark the whole __generated__ directory as generated, but then I don't know much about GraphQL and it looks like you have some reservations about it. Anything specific that makes you think this could be "unsafe" (i.e., not the expected user behavior)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds good to me. In a GraphQL relay project it is definitely safe to mark all files under the __generated__ directory as generated. I'm not sure about other languages/frameworks, and if they ever would use a __generated__ directory for some other purpose... yeah probably never...

One sec will make the change

Copy link
Contributor

Choose a reason for hiding this comment

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

From what I could see in the search results, it looks like it's not really used outside of GraphQL. Worst-case scenario, we'll reverse if we have users complaining :/

@@ -54,6 +54,7 @@ def generated?
xcode_file? ||
cocoapods? ||
carthage_build? ||
generated_graphql_relay_js? ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe remove _js at the end of the name, now that we're marking the whole directory as generated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

Copy link
Contributor

@pchaigno pchaigno left a comment

Choose a reason for hiding this comment

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

Thanks for submitting the pull request and for the explanations @vkmita!

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the PR and welcome to Linguist.

@lildude lildude merged commit 0f41c35 into github-linguist:master May 2, 2018
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants