eslint-plugin-spruce
Advanced tools
Comparing version 8.13.1-pre-b9501dbf.0 to 8.13.1-pre-dc345191.0
@@ -6,10 +6,19 @@ # Change Log | ||
## [8.13.1-pre-b9501dbf.0](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/compare/v8.13.0...v8.13.1-pre-b9501dbf.0) (2019-03-22) | ||
## [8.13.1-pre-dc345191.0](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/compare/v8.13.0...v8.13.1-pre-dc345191.0) (2019-04-11) | ||
**Note:** Version bump only for package eslint-plugin-spruce | ||
### Bug Fixes | ||
* **lint:** Update dependencies for shared lint config ([89b255f](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/commit/89b255f)) | ||
### Features | ||
* **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)) | ||
# [8.13.0](https://github.com/sprucelabsai/workspace.sprucebot-skills-kit/compare/v8.12.0...v8.13.0) (2019-03-20) | ||
@@ -16,0 +25,0 @@ |
31
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,18 @@ | ||
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') { | ||
return context.report( | ||
node, | ||
`The first argument to \`${ | ||
rule.method | ||
}\` must be an object of options.` | ||
) | ||
} | ||
const QueryOption = node.arguments[0].properties.find( | ||
@@ -16,0 +41,0 @@ o => o.key.name === rule.option |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "8.13.1-pre-b9501dbf.0", | ||
"version": "8.13.1-pre-dc345191.0", | ||
"description": "ESLint plugin for Spruce Javascript projects", | ||
@@ -21,3 +21,3 @@ "author": "George Pantazis <gcpantazis@gmail.com>", | ||
}, | ||
"gitHead": "32473cf56299eb36112cffa96f112b4faa5f51c3" | ||
"gitHead": "dae9a8c19e01ad99f90189e8d04d5364ea49597c" | ||
} |
5562
113