CallExpression()

in src/rule-graphql-naming.js [137:176]


      CallExpression(node) {
        if (!isCreateContainerCall(node)) {
          return;
        }
        const fragments = node.arguments[1];
        if (fragments.type === 'ObjectExpression') {
          fragments.properties.forEach(property => {
            if (
              property.type === 'Property' &&
              property.key.type === 'Identifier' &&
              property.computed === false &&
              property.value.type === 'TaggedTemplateExpression'
            ) {
              if (!isGraphQLTag(property.value.tag)) {
                context.report({
                  node: property.value.tag,
                  message:
                    '`{{callee}}` expects GraphQL to be tagged with ' +
                    'graphql`...`.',
                  data: {
                    callee: calleeToString(node.callee)
                  }
                });
                return;
              }
              validateTemplate(context, property.value, property.key.name);
            } else {
              context.report({
                node: property,
                message:
                  '`{{callee}}` expects fragment definitions to be ' +
                  '`key: graphql`.',
                data: {
                  callee: calleeToString(node.callee)
                }
              });
            }
          });
        }
      }