eslint-plugin-graphql
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -0,1 +1,11 @@ | ||
# Change log | ||
### vNEXT | ||
- ... | ||
### v0.4.2 | ||
- Added `'literal'` option to `env` for when working with `.graphql` and `.gql` files, by [jtmthf in #36](https://github.com/apollostack/eslint-plugin-graphql/pull/36) | ||
### v0.4.1 | ||
@@ -2,0 +12,0 @@ |
@@ -171,4 +171,4 @@ 'use strict'; | ||
// Validate env | ||
if (env && env !== 'lokka' && env !== 'relay' && env !== 'apollo') { | ||
throw new Error('Invalid option for env, only `apollo`, `lokka`, and `relay` supported.'); | ||
if (env && env !== 'lokka' && env !== 'relay' && env !== 'apollo' && env !== 'literal') { | ||
throw new Error('Invalid option for env, only `apollo`, `lokka`, `relay`, and `literal` supported.'); | ||
} | ||
@@ -182,2 +182,4 @@ | ||
tagName = 'Relay.QL'; | ||
} else if (env === 'literal') { | ||
tagName = internalTag; | ||
} else { | ||
@@ -184,0 +186,0 @@ tagName = 'gql'; |
{ | ||
"name": "eslint-plugin-graphql", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "GraphQL ESLint plugin.", | ||
@@ -5,0 +5,0 @@ "author": "Sashko Stubailo", |
@@ -55,6 +55,6 @@ # eslint-plugin-graphql | ||
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 | ||
``` | ||
@@ -71,3 +71,3 @@ | ||
// Import default settings for your GraphQL client. Supported values: | ||
// 'apollo', 'relay', 'lokka' | ||
// 'apollo', 'relay', 'lokka', 'literal' | ||
env: 'apollo', | ||
@@ -99,3 +99,3 @@ | ||
// Import default settings for your GraphQL client. Supported values: | ||
// 'apollo', 'relay', 'lokka' | ||
// 'apollo', 'relay', 'lokka', 'literal' | ||
env: 'relay', | ||
@@ -127,3 +127,3 @@ | ||
// Import default settings for your GraphQL client. Supported values: | ||
// 'apollo', 'relay', 'lokka' | ||
// 'apollo', 'relay', 'lokka', 'literal' | ||
env: 'lokka', | ||
@@ -147,2 +147,29 @@ | ||
### 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 | ||
@@ -149,0 +176,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
61317
323
246