Creating Custom Rules #1154
Replies: 4 comments 2 replies
-
Did you read comments in this patch? Do you still need a patch for your project? I don’t think so |
Beta Was this translation helpful? Give feedback.
-
Yeah I read the comments. I'm using So the basic question is ... how do you recommend setting up custom rules? Can I do this as a standalone plugin in my monorepo? Should I do it as a standalone package that consumes / utilizes |
Beta Was this translation helpful? Give feedback.
-
I’m also using the [GraphQLRuleTester](https://github.com/B2o5T/graphql-eslint/blob/master/docs/custom-rules.md#testing-your-rules) and without the eslint patch this is the one that fails with “ The rule fixed the code. Please add 'output' property.”
I guess I’ll just try it with its own patched version of eslint 🤷♂️
Sent from space
… On Sep 5, 2022, at 3:00 PM, Dimitri POSTOLOV ***@***.***> wrote:
You don’t need to clone graphql-eslint in your monorepo, and yes, if you want to share your custom rules it must be as your standalone eslint plugin
From graphql-eslint you should use only graphql parser to parse your graphql document into AST that eslint can understand
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
Alright I’ll try that. Thanks!
Sent from space
… On Sep 5, 2022, at 4:23 PM, Dimitri POSTOLOV ***@***.***> wrote:
So just add output property. I don’t use output since I already use snapshots testing, for this reason I patch source code
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
Hey there -
I've been tinkering with creating some custom rules - one example would be ensuring any list types are plural.
If I clone this repo and add my custom rules there, everything works fine. However I'd rather define them in my monorepo (which uses
nx
) ... but I'm running into a problem.Since
graphql-eslint
usespatch-package
to patcheslint
srule-tester.js
, I can't just create this as a standard nx lib, which would share the same root package.json / node_modules folder, as the rest of my tests won't get assertions anymore 😂What is the general guidance on this? Should I be forking
graphql-eslint
and managing my rules in that forked repo? If I want to have a custom plugin that utilizesgraphql-eslint
, does it need to have a standalone package w/ the postinstall executingpatch-package
? What do other people typically do?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions