-
Notifications
You must be signed in to change notification settings - Fork 2
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
Import relayOperationGenericsRule #1
Conversation
Danger run resulted in 1 warning; to find out more, see the checks page. Generated by 🚫 dangerJS |
Danger run resulted in 1 warning; to find out more, see the checks page. Generated by 🚫 dangerJS |
Aww jeez |
package.json
Outdated
@@ -48,5 +49,8 @@ | |||
"yarn prettier --write", | |||
"git add" | |||
] | |||
}, | |||
"dependencies": { | |||
"graphql": "^14.0.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s customary to make these types of dependencies peer ones, although I think that’s more important when it’s a dep that will be used at runtime to ensure the app has only 1 version of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, interesting! It took until now for me to get the distinction, this blog post was helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s an art!
src/relayOperationGenericsRule.ts
Outdated
* @param {number} width | ||
* @param {string} replacement | ||
* @param {string} operationName | ||
* @returns {Lint.Replacement[]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe these type annotations can be removed when using TS, which already has these in its function signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I've been working my way down the file and switching them over 👍
src/relayOperationGenericsRule.ts
Outdated
@@ -0,0 +1,198 @@ | |||
import { BREAK, parse, visit } from "graphql" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth it to import this * as graphql
as these symbols could be slightly confusing when used together with the tsc API
Ah yes! Nice 👌 |
Btw, I’d appreciate it if you could make me the author of the initial commit (of only the rule file), even if just for knowing who to talk to if there’s ever any questions 🙏 |
Let‘s move it to the relay-tools org before cutting the first release. I’ll invite you to the org now. |
Sure, sounds good 👍 Thanks! |
0c115f5
to
3f1205f
Compare
Thanks! |
3f1205f
to
be960fc
Compare
"typescript": "^3.0.3" | ||
"tslint-config-prettier": "^1.15.0", | ||
"typescript": "^3.0.3", | ||
"graphql": "^14.0.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to put this in devDependencies
because peer deps aren't installed by default.
Okay, this just needs testing now. Before we publish, we can link locally on reaction and make sure it will work. I'm expecting to have to faff with TSLint to get it to load rules from node modules. |
I've found this blog post helpful for getting the package set up and linked from Reaction: https://palantir.github.io/tslint/2016/03/31/sharable-configurations-rules.html Also, it's not possible to link against a package that has no published version (see this issue) so I added the following to Reaction's "tslint-plugin-relay": "link:../tslint-plugin-relay" Which sets up the symlink on |
Okay, the blog post I linked to is a bit outdated since it doesn't permit TypeScript rules. I've modified how we compile to point to the It's not working when linked locally, but I think it might be a problem with the module resolution that our symlink is not adhering too. I'm going to merge, move the repo to the relay-tools org, then publish a v0.0.1 so we can test on Reaction. |
Woo! https://www.npmjs.com/package/tslint-plugin-relay Okay, linking works. I looked and there were two problems:
I'll fix both, verify this is working, then PR to Reaction 👍 |
Oh shoot. It looks like a rebase erased the git author status for Eloy on the initial import. I did a force-push on master to correct before anyone sees 🙈 |
Woohoo! Nice job, @ashfurrow 👏 |
This is a work-in-progress PR to import relayOperationGenericsRule.js into this project, including a transition to TypeScript proper instead of
@ts-check
. It's a WIP because I ran out of time this morning. Next steps are to finish it, link it from Reaction, and get Reaction consuming the rule from a module. Then we can think about tests, too, and then add this and other eslint-plugin-relay rules to this project. And then publish to NPM. Baby steps.See also: artsy/yeoman-generator-artsy#10
/cc @alloy