graphql-schema-linter
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -6,14 +6,2 @@ #!/usr/bin/env node | ||
var _minimist = require('minimist'); | ||
var _minimist2 = _interopRequireDefault(_minimist); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var argv = (0, _minimist2.default)(process.argv.slice(2), { | ||
string: ["format"], | ||
boolean: ["stdin"], | ||
default: { format: "text" } | ||
}); | ||
(0, _runner.run)(argv); | ||
(0, _runner.run)(process.argv.slice(2)); |
@@ -5,3 +5,2 @@ 'use strict'; | ||
module.exports.rules = require('./rules/index.js'); | ||
module.exports.validator = require('./validator.js'); | ||
module.exports.cli = require('./cli.js'); | ||
module.exports.validator = require('./validator.js'); |
@@ -26,5 +26,15 @@ 'use strict'; | ||
var _minimist = require('minimist'); | ||
var _minimist2 = _interopRequireDefault(_minimist); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function run(options) { | ||
function run(argv) { | ||
var options = (0, _minimist2.default)(argv, { | ||
string: ["format"], | ||
boolean: ["stdin"], | ||
default: { format: "text" } | ||
}); | ||
var schema = getSchema(options); | ||
@@ -41,2 +51,4 @@ var formatter = getFormatter(options); | ||
process.stdout.write(output); | ||
process.exit(errors.length > 0 ? 1 : 0); | ||
} | ||
@@ -43,0 +55,0 @@ |
{ | ||
"name": "graphql-schema-linter", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Command line tool and package to validate GraphQL schemas against a set of rules.", | ||
@@ -5,0 +5,0 @@ "author": "Christian Joudrey", |
@@ -5,2 +5,4 @@ # graphql-schema-linter | ||
If you're looking to lint your GraphQL queries, check out this ESLint plugin: [apollographql/eslint-plugin-graphql](https://github.com/apollographql/eslint-plugin-graphql). | ||
_This is still work in progress._ | ||
@@ -10,3 +12,11 @@ | ||
Yarn: | ||
``` | ||
yarn global add graphql-schema-linter | ||
``` | ||
NPM: | ||
``` | ||
npm install -g graphql-schema-linter | ||
@@ -33,4 +43,46 @@ ``` | ||
## Current rules | ||
## Output formatters | ||
The format of the output can be controlled via the `--format` option. | ||
The following formatters are currently available: | ||
### `TextFormatter` (default) | ||
Sample output: | ||
``` | ||
5:1 The object type `QueryRoot` is missing a description. | ||
6:3 The field `QueryRoot.a` is missing a description. | ||
``` | ||
Each error is prefixed with the line number and column the error occurred on. | ||
### `JSONFormatter` | ||
Sample output: | ||
```json | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "The object type `QueryRoot` is missing a description.", | ||
"location": { | ||
"line": 5, | ||
"column": 1 | ||
} | ||
}, | ||
{ | ||
"message": "The field `QueryRoot.a` is missing a description.", | ||
"location": { | ||
"line": 6, | ||
"column": 3 | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
## Built-in rules | ||
### `DeprecationsHaveAReason` | ||
@@ -37,0 +89,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107997
22
100
260