【发布时间】:2020-06-10 16:12:57
【问题描述】:
这是我正在使用的当前 graphQL 的模拟。
const aDynamicListOfFieldsComingFromElsewhere = 'foo bar anotherField etc'
const query = gql`{
QueryResult: TableName {
Data {
id
name
${aDynamicListOfFieldsComingFromElsewhere}
}
}
}`
这...从功能上讲,有效。但是由于多种原因被认为是一种不好的方法,其中一个是 eslint-plugin-graphql 提供的 linting 支持。
Eslint 给了我以下错误提示:
Invalid interpolation - fragment interpolation must occur outside of the brackets graphql/template-strings
我设法找到了一些很好的变量示例,但没有一个提供包含外部定义变量的方法。
提前感谢您的帮助!
【问题讨论】:
标签: graphql eslint apollo-client graphql-js