graphql-eslint icon indicating copy to clipboard operation
graphql-eslint copied to clipboard

@graphql-eslint/known-directives - allow specifying extra whitelisted directives

Open osdiab opened this issue 11 months ago • 1 comments

Is your feature request related to a problem? Please describe.

I am using https://github.com/0no-co/gql.tada which introduces an @_unmask directive which isn't in my actual schema. I can't use it without disabling this ESLint rule, which is a bummer

Describe the solution you'd like

allow specifying that @_unmask is allowed in addition to whatever is in my schema

Describe alternatives you've considered

just disabling it when I use it

Additional context

osdiab avatar Mar 14 '24 09:03 osdiab

This also applies to directives defined by external modules, i.e. which can't be detected through static code analysis. E.g.

// rateLimit.ts
import { rateLimitDirective } from 'graphql-rate-limit-directive';

const directive = rateLimitDirective();

export const typeDefs = [directive.rateLimitDirectiveTypeDefs];

export const transforms = [directive.rateLimitDirectiveTransformer];

// MyField.ts
export const typeDefs = [
  /* GraphQL */ `
  extend type Mutation {
    myField: MyField @rateLimit(duration: 3600, limit: 100)
  }
  `
];

felamaslen avatar Jul 12 '24 21:07 felamaslen