Skip to content

Commit

Permalink
Updated README docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jtmthf committed Dec 13, 2016
1 parent f439a58 commit 5ce9254
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2,448 deletions.
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ Note: the linter rule could be extended to identify calls to various specific AP
### GraphQL literal files

This plugin also lints GraphQL literal files ending on `.gql` or `.graphql`.
In order to do so just tell eslint to check these files as well.
In order to do so set `env` to `'literal'` in your `.eslintrc.js` and tell eslint to check these files as well.

```BASH
eslint . --ext js,gql,graphql
eslint . --ext .js --ext .gql --ext .graphql
```

### Example config for Apollo
Expand All @@ -67,7 +67,7 @@ module.exports = {
rules: {
"graphql/template-strings": ['error', {
// Import default settings for your GraphQL client. Supported values:
// 'apollo', 'relay', 'lokka'
// 'apollo', 'relay', 'lokka', 'literal'
env: 'apollo',

// Import your schema JSON here
Expand All @@ -94,7 +94,7 @@ module.exports = {
rules: {
"graphql/template-strings": ['error', {
// Import default settings for your GraphQL client. Supported values:
// 'apollo', 'relay', 'lokka'
// 'apollo', 'relay', 'lokka', 'literal'
env: 'relay',

// Import your schema JSON here
Expand All @@ -121,7 +121,7 @@ module.exports = {
rules: {
"graphql/template-strings": ['error', {
// Import default settings for your GraphQL client. Supported values:
// 'apollo', 'relay', 'lokka'
// 'apollo', 'relay', 'lokka', 'literal'
env: 'lokka',

// Import your schema JSON here
Expand All @@ -140,6 +140,33 @@ module.exports = {
}
```

### Example config for literal graphql files

```js
// In a file called .eslintrc.js
module.exports = {
parser: "babel-eslint",
rules: {
"graphql/template-strings": ['error', {
// Import default settings for your GraphQL client. Supported values:
// 'apollo', 'relay', 'lokka', 'literal'
env: 'literal',

// Import your schema JSON here
schemaJson: require('./schema.json'),

// OR provide absolute path to your schema JSON
// schemaJsonFilepath: path.resolve(__dirname, './schema.json'),

// tagName is set automatically
}]
},
plugins: [
'graphql'
]
}
```

### Additional Schemas or Tags

This plugin can be used to validate against multiple schemas by identifying them with different tags. This is useful for applications interacting with multiple GraphQL systems. Additional schemas can simply be appended to the options list:
Expand Down
Loading

0 comments on commit 5ce9254

Please sign in to comment.