Handle fragments that are defined separately from use
lorensr opened this issue · comments
Linting the below file results in errors:
4:3 error Fragment "ReviewEntry" is never used graphql/template-strings
22:10 error Unknown fragment "ReviewEntry" graphql/template-strings
Is there a way to either:
A. support this format of using fragments, or
B. turn off just this rule?
import gql from 'graphql-tag'
export const REVIEW_ENTRY = gql`
fragment ReviewEntry on Review {
id
text
}
`
export const ON_REVIEW_CREATED_SUBSCRIPTION = gql`
subscription onReviewCreated {
reviewCreated {
...ReviewEntry
}
}
${REVIEW_ENTRY}
`
i go into more detail here but has to due with not being able to statically analyze the interpolated fragment.
the resolution here may be to ignore the NoUsedFragment
rule, but the only way to configure this right now is to safelist the list of validators you want to use.
addressing #98 should make this more straightforward.