check-apollo-provider
Ast Rule: html element
check-apollo-provider
function visit(node, filename, code) {
if (node.tag && node.tag.value === "ApolloProvider") {
const hasClient = node.attributes.filter(a => a.name && a.name.value && a.name.value === "client").length > 0;
if (!hasClient) {
const error = buildError(node.tag.start.line, node.tag.start.col,
node.tag.end.line, node.tag.end.col,
"must provide a client attribute", "WARNING", "BEST_PRACTICE");
addError(error);
}
}
}
without-client.js
Expected test result: has error
with-client.js
Expected test result: no error