eslint-plugin-spruce
Advanced tools
Comparing version 8.13.1-pre-7307bf80.0 to 8.13.1-pre-82f30935.0
@@ -6,3 +6,3 @@ # Change Log | ||
## [8.13.1-pre-7307bf80.0](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/compare/v8.13.0...v8.13.1-pre-7307bf80.0) (2019-04-10) | ||
## [8.13.1-pre-82f30935.0](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/compare/v8.13.0...v8.13.1-pre-82f30935.0) (2019-04-10) | ||
@@ -17,2 +17,3 @@ | ||
* **lint:** Enforce GQL linting in skills ([b9d9b00](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/commit/b9d9b00)) | ||
* **lint:** Enforce that query/mutate must be called with an object of options. ([78d2c3f](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/commit/78d2c3f)) | ||
@@ -19,0 +20,0 @@ |
22
index.js
const rules = [ | ||
{ method: 'query', option: 'query', suffix: 'QueryString' }, | ||
{ method: 'mutate', option: 'mutation', suffix: 'MutationString' } | ||
{ | ||
method: 'query', | ||
option: 'query', | ||
suffix: 'QueryString', | ||
allowedParents: ['gqlClient'] | ||
}, | ||
{ | ||
method: 'mutate', | ||
option: 'mutation', | ||
suffix: 'MutationString', | ||
allowedParents: ['gqlClient'] | ||
} | ||
] | ||
@@ -13,3 +23,9 @@ | ||
rules.forEach(rule => { | ||
if (node.callee.name === rule.method) { | ||
if ( | ||
node.callee.name === rule.method || | ||
(node.callee.property && | ||
node.callee.property.name === rule.method && | ||
node.callee.object && | ||
rule.allowedParents.indexOf(node.callee.object.name) >= 0) | ||
) { | ||
if (node.arguments[0].type !== 'ObjectExpression') { | ||
@@ -16,0 +32,0 @@ return context.report( |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "8.13.1-pre-7307bf80.0", | ||
"version": "8.13.1-pre-82f30935.0", | ||
"description": "ESLint plugin for Spruce Javascript projects", | ||
@@ -21,3 +21,3 @@ "author": "George Pantazis <gcpantazis@gmail.com>", | ||
}, | ||
"gitHead": "407417f01a4ac71bfe70be637ca01d7c80139389" | ||
"gitHead": "a2917d6b148f726dcf47a0bf02456d26da504f78" | ||
} |
5562
113