WIP - add extractor, generate snippet_data
This commit is contained in:
12
node_modules/eslint-plugin-graphql/.eslintrc.js
generated
vendored
Normal file
12
node_modules/eslint-plugin-graphql/.eslintrc.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
extends: "eslint:recommended",
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: "module"
|
||||
},
|
||||
env: {
|
||||
mocha: true,
|
||||
node: true,
|
||||
es6: true,
|
||||
}
|
||||
};
|
||||
15
node_modules/eslint-plugin-graphql/.github/PULL_REQUEST_TEMPLATE.md
generated
vendored
Normal file
15
node_modules/eslint-plugin-graphql/.github/PULL_REQUEST_TEMPLATE.md
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<!--
|
||||
Thanks for filing a pull request on eslint-plugin-graphql!
|
||||
|
||||
Please look at the following checklist to ensure that your PR
|
||||
can be accepted quickly:
|
||||
-->
|
||||
|
||||
TODO:
|
||||
|
||||
- [ ] Make sure all of the significant new logic is covered by tests
|
||||
- [ ] Rebase your changes on master so that they can be merged easily
|
||||
- [ ] Make sure all tests pass
|
||||
- [ ] Update CHANGELOG.md with your change
|
||||
- [ ] If this was a change that affects the external API, update the README
|
||||
|
||||
4
node_modules/eslint-plugin-graphql/.tav.yml
generated
vendored
Normal file
4
node_modules/eslint-plugin-graphql/.tav.yml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
graphql:
|
||||
versions: ^0.12.0 || ^0.13.0 || ^14.0.0
|
||||
commands: mocha test/index.js
|
||||
12
node_modules/eslint-plugin-graphql/.travis.yml
generated
vendored
Normal file
12
node_modules/eslint-plugin-graphql/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "8"
|
||||
- "10"
|
||||
install:
|
||||
- npm install
|
||||
|
||||
script:
|
||||
- npm run lint && npm test
|
||||
|
||||
# Allow Travis tests to run in containers.
|
||||
sudo: false
|
||||
117
node_modules/eslint-plugin-graphql/CHANGELOG.md
generated
vendored
Normal file
117
node_modules/eslint-plugin-graphql/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
# Change log
|
||||
|
||||
### vNEXT
|
||||
|
||||
### v3.0.3
|
||||
|
||||
- chore: Update dependency `graphql-tools` to `v4.0.4`. [PR #210](https://github.com/apollographql/eslint-plugin-graphql/pull/210)
|
||||
- chore: Update dependency `eslint` to `v5.12.1`. [PR #206](https://github.com/apollographql/eslint-plugin-graphql/pull/206)
|
||||
- chore: Update dependency `graphql` to `v14.1.1`. [PR #208](https://github.com/apollographql/eslint-plugin-graphql/pull/208)
|
||||
|
||||
### v3.0.2
|
||||
|
||||
- Fix regression which caused `graphql/required-fields` to throw on non-existent field references. [PR #203](https://github.com/apollographql/eslint-plugin-graphql/pull/203) by [Matt Bretl](https://github.com/mattbretl)
|
||||
|
||||
### v3.0.1
|
||||
|
||||
- Fix support for multi-schema workspaces [PR #179](https://github.com/apollographql/eslint-plugin-graphql/pull/179) by [Pat Sissons](https://github.com/patsissons)
|
||||
|
||||
### v3.0.0
|
||||
|
||||
- BREAKING: The `required-fields` rule has been significantly changed to make it a completely reliable method of ensuring an `id` field (or any other field name) is always requested when available. [PR #199](https://github.com/apollographql/eslint-plugin-graphql/pull/199) Here is the behavior, let's say we are requiring field `id`:
|
||||
- On any field whose return type defines a field called `id`, the selection set must directly contain `id`.
|
||||
- In any named fragment declaration whose type defines a field called `id`, the selection set must directly contain `id`.
|
||||
- An inline fragment whose type defines a field called `id` must contain `id` in its selection set unless its parent is also an inline fragment that contains the field `id`.
|
||||
- Here's a specific case which is _no longer valid_:
|
||||
- `query { greetings { hello ... on Greetings { id } } }`
|
||||
- This must now be written as `query { greetings { id hello ... on Greetings { id } } }`
|
||||
- This is a more conservative approach than before, driven by the fact that it's quite hard to ensure that a combination of inline fragments actually covers all of the possible types of a selection set.
|
||||
- Fix breaking change in `graphql@^14.0.0` that renamed `ProvidedNonNullArguments` to `ProvidedRequiredArguments` [#192](https://github.com/apollographql/eslint-plugin-graphql/pull/192)
|
||||
- Update dependencies to graphql-tools 4 and eslint 5.9 [#193](https://github.com/apollographql/eslint-plugin-graphql/pull/193)
|
||||
|
||||
### v2.1.1
|
||||
- Fix support for InlineFragments with the `required-fields` rule in [#140](https://github.com/apollographql/eslint-plugin-graphql/pull/140/files) by [Steve Hollaar](https://github.com/stevehollaar)
|
||||
- Fix error location information for literal .graphql files and strings with leading newlines in [#122](https://github.com/apollographql/eslint-plugin-graphql/pull/122) by [Dan Freeman](https://github.com/dfreeman)
|
||||
- Add [`fraql`](https://github.com/smooth-code/fraql) environment
|
||||
|
||||
### v2.1.0
|
||||
- Retrieves `.graphqlconfig` relative to the file being linted, which re-enables support for `vscode-eslint` using `.graphqlconfig` in [#108](https://github.com/apollographql/eslint-plugin-graphql/pull/108) by [Jon Wong][https://github.com/jnwng/]
|
||||
- Cache schema reading/parsing results each time a rule is created in [#137](https://github.com/apollographql/eslint-plugin-graphql/pull/137) by [Kristján Oddsson](https://github.com/koddsson)
|
||||
|
||||
### v2.0.0
|
||||
- Add support for `graphql-js@^0.12.0` and `graphql-js@^0.13.0` in [Jon Wong](https://github.com/jnwng/)[#119] (https://github.com/apollographql/eslint-plugin-graphql/pull/93)
|
||||
- Update list of available validators in [#121]((https://github.com/apollographql/eslint-plugin-graphql/pull/121) by [Pleun Vanderbauwhede](https://github.com/pleunv)
|
||||
- Update supported Node `engines` to >= 6.0 in [#133](https://github.com/apollographql/eslint-plugin-graphql/pull/133) by [Jon Wong](https://github.com/jnwng/)
|
||||
|
||||
### v1.5.0
|
||||
- Add new rule `no-deprecated-fields` in [Kristján Oddsson](https://github.com/koddsson/)[#92](https://github.com/apollographql/eslint-plugin-graphql/pull/93)
|
||||
- Add support for deprecated fields on enums in [#100](https://github.com/apollographql/eslint-plugin-graphql/pull/100) by [Daniel Rinehart](https://github.com/NeoPhi)
|
||||
- Bumped `babel-eslint` and pinned `graphql-config` in [#101](https://github.com/apollographql/eslint-plugin-graphql/pull/101) by [Jon Wong](https://github.com/jnwng)
|
||||
|
||||
### v1.4.1
|
||||
Skipped v1.4.0 because of incorrect version tag in `package.json`
|
||||
- Move `graphql-js` to `peerDependencies`, support `graphql@^0.11.0` in [Jon Wong](https://github.com/jnwng/)[#91](https://github.com/apollographql/eslint-plugin-graphql/pull/91)
|
||||
- Fix escaping of literal .graphql files [Simon Lydell](https://github.com/lydell/) in [#88](https://github.com/apollographql/eslint-plugin-graphql/pull/88)
|
||||
- Fix ESLint config validation [Simon Lydell](https://github.com/lydell/) in [#86](https://github.com/apollographql/eslint-plugin-graphql/pull/86)
|
||||
|
||||
### v1.3.0
|
||||
- add support for [.graphqlconfig](https://github.com/graphcool/graphql-config) [Roman Hotsiy](https://github.com/RomanGotsiy) in [#80](https://github.com/apollographql/eslint-plugin-graphql/pull/80)
|
||||
- add `graphql/capitalized-type-name` rule to warn on uncapitalized type names [DianaSuvorova](https://github.com/DianaSuvorova) in [#81](https://github.com/apollographql/eslint-plugin-graphql/pull/81)
|
||||
|
||||
### v1.2.0
|
||||
- Add env config option for required-fields rule [Justin Schulz](https://github.com/PepperTeasdale) in [#75](https://github.com/apollographql/eslint-plugin-graphql/pull/75)
|
||||
|
||||
### v1.1.0
|
||||
- Add option to pass schema as string [Christopher Cliff](https://github.com/christophercliff) in [#78](https://github.com/apollographql/eslint-plugin-graphql/pull/78)
|
||||
|
||||
### v1.0.0
|
||||
- Fix template env for older runtimes (eg. node 5 and earlier) [Justin Schulz](https://github.com/PepperTeasdale) in [#73](https://github.com/apollographql/eslint-plugin-graphql/pull/73)
|
||||
- Updated `graphql-js` to `v0.10.1` in [#67](https://github.com/apollographql/eslint-plugin-graphql/pull/67) [Sashko Stubailo](https://github.com/stubailo)
|
||||
|
||||
### v0.8.2
|
||||
- Remove `KnownFragmentNames` and `UnusedFragment` from default rules in `literal` env. [Justin Schulz](https://github.com/PepperTeasdale) in [#70](https://github.com/apollographql/eslint-plugin-graphql/pull/70)
|
||||
|
||||
### v0.8.1
|
||||
- Fix `graphql/required-fields` throwing on non-existent field reference [Benjie](https://github.com/benjie) in [#65](https://github.com/apollographql/eslint-plugin-graphql/pull/65)
|
||||
|
||||
### v0.8.0
|
||||
|
||||
- Updated `graphql` dependency to resolve test failures ([wording change](https://github.com/graphql/graphql-js/commit/ba401e154461bca5323ca9121c6dacaee10ebe88), no API change) [jnwng](https://github.com/jnwng)
|
||||
- Add lint rule to enforce that required fields are specified. [rgoldfinger](https://github.com/rgoldfinger) in [#47](https://github.com/apollographql/eslint-plugin-graphql/pull/50)
|
||||
|
||||
### v0.7.0
|
||||
- Add lint rule to enforce that operations have names [gauravmk](https://github.com/gauravmk) in [#47](https://github.com/apollographql/eslint-plugin-graphql/pull/47)
|
||||
|
||||
### v0.6.1
|
||||
|
||||
- Remove `babel-polyfill` from runtime dependencies, since it was only being used in test code. [joelgriffith](https://github.com/joelgriffith) in [#44](https://github.com/apollographql/eslint-plugin-graphql/pull/44)
|
||||
|
||||
### v0.6.0
|
||||
- Update graphql-js dependency to 0.9.0 [jonbretman](https://github.com/jonbretman) in [#41](https://github.com/apollostack/eslint-plugin-graphql/pull/41)
|
||||
|
||||
### v0.5.0
|
||||
- Take into account Apollo fragment interpolation rules [jnwng](https://github.com/jnwng) in [#33](https://github.com/apollostack/eslint-plugin-graphql/pull/33)
|
||||
- Update graphql-js dependency to 0.8.2 [jonbretman](https://github.com/jonbretman) in [#40](https://github.com/apollostack/eslint-plugin-graphql/pull/40)
|
||||
|
||||
|
||||
### v0.4.3
|
||||
|
||||
- Add `'literal'` option to options schema, so that it can actually be used. [stefanorg](https://github.com/stefanorg) in [#39](https://github.com/apollostack/eslint-plugin-graphql/pull/39)
|
||||
|
||||
### 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
|
||||
|
||||
- Support for selecting validation rules one by one, by [erydo in
|
||||
#34](https://github.com/apollostack/eslint-plugin-graphql/pull/34)
|
||||
|
||||
### v0.4.0
|
||||
|
||||
- Support for multiple schemas, by [erydo in
|
||||
#31](https://github.com/apollostack/eslint-plugin-graphql/pull/31)
|
||||
|
||||
### v0.3.1
|
||||
|
||||
- We didn't keep track of changes before this version. Consult the commit log.
|
||||
82
node_modules/eslint-plugin-graphql/CONTRIBUTING.md
generated
vendored
Normal file
82
node_modules/eslint-plugin-graphql/CONTRIBUTING.md
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
# Apollo Contributor Guide
|
||||
|
||||
Excited about Apollo and want to make it better? We’re excited too!
|
||||
|
||||
Apollo is a community of developers just like you, striving to create the best tools and libraries around GraphQL. We welcome anyone who wants to contribute or provide constructive feedback, no matter the age or level of experience. If you want to help but don't know where to start, let us know, and we'll find something for you.
|
||||
|
||||
Oh, and if you haven't already, sign up for the [Apollo Slack](http://www.apollodata.com/#slack).
|
||||
|
||||
Here are some ways to contribute to the project, from easiest to most difficult:
|
||||
|
||||
* [Reporting bugs](#reporting-bugs)
|
||||
* [Improving the documentation](#improving-the-documentation)
|
||||
* [Responding to issues](#responding-to-issues)
|
||||
* [Small bug fixes](#small-bug-fixes)
|
||||
* [Suggesting features](#suggesting-features)
|
||||
* [Big pull requests](#big-prs)
|
||||
|
||||
## Issues
|
||||
|
||||
### Reporting bugs
|
||||
|
||||
If you encounter a bug, please file an issue on GitHub via the repository of the sub-project you think contains the bug. If an issue you have is already reported, please add additional information or add a 👍 reaction to indicate your agreement.
|
||||
|
||||
While we will try to be as helpful as we can on any issue reported, please include the following to maximize the chances of a quick fix:
|
||||
|
||||
1. **Intended outcome:** What you were trying to accomplish when the bug occurred, and as much code as possible related to the source of the problem.
|
||||
2. **Actual outcome:** A description of what actually happened, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. Please avoid non-specific phrases like “didn’t work” or “broke”.
|
||||
3. **How to reproduce the issue:** Instructions for how the issue can be reproduced by a maintainer or contributor. Be as specific as possible, and only mention what is necessary to reproduce the bug. If possible, try to isolate the exact circumstances in which the bug occurs and avoid speculation over what the cause might be.
|
||||
|
||||
Creating a good reproduction really helps contributors investigate and resolve your issue quickly. In many cases, the act of creating a minimal reproduction illuminates that the source of the bug was somewhere outside the library in question, saving time and effort for everyone.
|
||||
|
||||
### Improving the documentation
|
||||
|
||||
Improving the documentation, examples, and other open source content can be the easiest way to contribute to the library. If you see a piece of content that can be better, open a PR with an improvement, no matter how small! If you would like to suggest a big change or major rewrite, we’d love to hear your ideas but please open an issue for discussion before writing the PR.
|
||||
|
||||
### Responding to issues
|
||||
|
||||
In addition to reporting issues, a great way to contribute to Apollo is to respond to other peoples' issues and try to identify the problem or help them work around it. If you’re interested in taking a more active role in this process, please go ahead and respond to issues. And don't forget to say "Hi" on Apollo Slack!
|
||||
|
||||
### Small bug fixes
|
||||
|
||||
For a small bug fix change (less than 20 lines of code changed), feel free to open a pull request. We’ll try to merge it as fast as possible and ideally publish a new release on the same day. The only requirement is, make sure you also add a test that verifies the bug you are trying to fix.
|
||||
|
||||
### Suggesting features
|
||||
|
||||
Most of the features in Apollo came from suggestions by you, the community! We welcome any ideas about how to make Apollo better for your use case. Unless there is overwhelming demand for a feature, it might not get implemented immediately, but please include as much information as possible that will help people have a discussion about your proposal:
|
||||
|
||||
1. **Use case:** What are you trying to accomplish, in specific terms? Often, there might already be a good way to do what you need and a new feature is unnecessary, but it’s hard to know without information about the specific use case.
|
||||
2. **Could this be a plugin?** In many cases, a feature might be too niche to be included in the core of a library, and is better implemented as a companion package. If there isn’t a way to extend the library to do what you want, could we add additional plugin APIs? It’s important to make the case for why a feature should be part of the core functionality of the library.
|
||||
3. **Is there a workaround?** Is this a more convenient way to do something that is already possible, or is there some blocker that makes a workaround unfeasible?
|
||||
|
||||
Feature requests will be labeled as such, and we encourage using GitHub issues as a place to discuss new features and possible implementation designs. Please refrain from submitting a pull request to implement a proposed feature until there is consensus that it should be included. This way, you can avoid putting in work that can’t be merged in.
|
||||
|
||||
Once there is a consensus on the need for a new feature, proceed as listed below under “Big PRs”.
|
||||
|
||||
## Big PRs
|
||||
|
||||
This includes:
|
||||
|
||||
- Big bug fixes
|
||||
- New features
|
||||
|
||||
For significant changes to a repository, it’s important to settle on a design before starting on the implementation. This way, we can make sure that major improvements get the care and attention they deserve. Since big changes can be risky and might not always get merged, it’s good to reduce the amount of possible wasted effort by agreeing on an implementation design/plan first.
|
||||
|
||||
1. **Open an issue.** Open an issue about your bug or feature, as described above.
|
||||
2. **Reach consensus.** Some contributors and community members should reach an agreement that this feature or bug is important, and that someone should work on implementing or fixing it.
|
||||
3. **Agree on intended behavior.** On the issue, reach an agreement about the desired behavior. In the case of a bug fix, it should be clear what it means for the bug to be fixed, and in the case of a feature, it should be clear what it will be like for developers to use the new feature.
|
||||
4. **Agree on implementation plan.** Write a plan for how this feature or bug fix should be implemented. What modules need to be added or rewritten? Should this be one pull request or multiple incremental improvements? Who is going to do each part?
|
||||
5. **Submit PR.** In the case where multiple dependent patches need to be made to implement the change, only submit one at a time. Otherwise, the others might get stale while the first is reviewed and merged. Make sure to avoid “while we’re here” type changes - if something isn’t relevant to the improvement at hand, it should be in a separate PR; this especially includes code style changes of unrelated code.
|
||||
6. **Review.** At least one core contributor should sign off on the change before it’s merged. Look at the “code review” section below to learn about factors are important in the code review. If you want to expedite the code being merged, try to review your own code first!
|
||||
7. **Merge and release!**
|
||||
|
||||
### Code review guidelines
|
||||
|
||||
It’s important that every piece of code in Apollo packages is reviewed by at least one core contributor familiar with that codebase. Here are some things we look for:
|
||||
|
||||
1. **Required CI checks pass.** This is a prerequisite for the review, and it is the PR author's responsibility. As long as the tests don’t pass, the PR won't get reviewed.
|
||||
2. **Simplicity.** Is this the simplest way to achieve the intended goal? If there are too many files, redundant functions, or complex lines of code, suggest a simpler way to do the same thing. In particular, avoid implementing an overly general solution when a simple, small, and pragmatic fix will do.
|
||||
3. **Testing.** Do the tests ensure this code won’t break when other stuff changes around it? When it does break, will the tests added help us identify which part of the library has the problem? Did we cover an appropriate set of edge cases? Look at the test coverage report if there is one. Are all significant code paths in the new code exercised at least once?
|
||||
4. **No unnecessary or unrelated changes.** PRs shouldn’t come with random formatting changes, especially in unrelated parts of the code. If there is some refactoring that needs to be done, it should be in a separate PR from a bug fix or feature, if possible.
|
||||
5. **Code has appropriate comments.** Code should be commented, or written in a clear “self-documenting” way.
|
||||
6. **Idiomatic use of the language.** In TypeScript, make sure the typings are specific and correct. In ES2015, make sure to use imports rather than require and const instead of var, etc. Ideally a linter enforces a lot of this, but use your common sense and follow the style of the surrounding code.
|
||||
583
node_modules/eslint-plugin-graphql/README.md
generated
vendored
Normal file
583
node_modules/eslint-plugin-graphql/README.md
generated
vendored
Normal file
@ -0,0 +1,583 @@
|
||||
# eslint-plugin-graphql
|
||||
[](https://badge.fury.io/js/eslint-plugin-graphql)
|
||||
[](https://travis-ci.org/apollographql/eslint-plugin-graphql)
|
||||
[](http://www.apollostack.com/#slack)
|
||||
|
||||
An ESLint plugin that checks tagged query strings inside JavaScript, or queries inside `.graphql` files, against a GraphQL schema.
|
||||
|
||||
```
|
||||
npm install eslint-plugin-graphql
|
||||
```
|
||||
|
||||

|
||||
|
||||
`eslint-plugin-graphql` has built-in settings for three GraphQL clients out of the box:
|
||||
|
||||
1. [Apollo client](http://docs.apollostack.com/apollo-client/index.html)
|
||||
2. [Relay](https://facebook.github.io/relay/)
|
||||
3. [Lokka](https://github.com/kadirahq/lokka)
|
||||
3. [FraQL](https://github.com/smooth-code/fraql)
|
||||
|
||||
If you want to lint your GraphQL schema, rather than queries, check out [cjoudrey/graphql-schema-linter](https://github.com/cjoudrey/graphql-schema-linter).
|
||||
|
||||
### Importing schema JSON
|
||||
|
||||
You'll need to import your [introspection query result](https://github.com/graphql/graphql-js/blob/master/src/utilities/introspectionQuery.js) or the schema as a string in the Schema Language format. This can be done if you define your ESLint config in a JS file.
|
||||
|
||||
### Retrieving a remote GraphQL schema
|
||||
|
||||
[graphql-cli](https://github.com/graphcool/graphql-cli) provides a `get-schema` command (in conjunction with a `.graphqlconfig` file) that makes retrieving remote schemas very simple.
|
||||
|
||||
[apollo-codegen](https://github.com/apollographql/apollo-codegen) also provides an [introspect-schema](https://github.com/apollographql/apollo-codegen#introspect-schema) command that can get your remote schemas as well
|
||||
|
||||
### Common options
|
||||
|
||||
All of the rules provided by this plugin have a few options in common. There are examples of how to use these with Apollo, Relay, Lokka, FraQL and literal files further down.
|
||||
|
||||
- `env`: Import default settings for your GraphQL client. Supported values: `'apollo'`, `'relay'`, `'lokka'`, `'fraql'` `'literal'`. Defaults to `'apollo'`. This is used for the slight parsing differences in the GraphQL syntax between Apollo, Relay, Lokka and FraQL as well as giving nice defaults to some other options.
|
||||
|
||||
- `tagName`: The name of the template literal tag that this plugin should look for when searching for GraphQL queries. It has different defaults depending on the `env` option:
|
||||
|
||||
- `'relay'`: `'Relay.QL'`
|
||||
- `'internal'`: Special automatic value
|
||||
- others: `'gql'`, `'graphql'`
|
||||
|
||||
You also have to specify a schema. You can either do it using _one_ of these options:
|
||||
|
||||
- `schemaJson`: Your schema as JSON.
|
||||
- `schemaJsonFilepath`: The absolute path to your schema as a .json file. (Warning: this variant is incompatible with `eslint --cache`.)
|
||||
- `schemaString`: Your schema in the Schema Language format as a string.
|
||||
|
||||
Alternatively, you can use a [.graphqlconfig](https://github.com/graphcool/graphql-config) file instead of the above three options. If you do there's one more option to know about:
|
||||
|
||||
- `projectName`: In case you specify multiple schemas in your `.graphqlconfig` file, choose which one to use by providing the project name here as a string.
|
||||
|
||||
There's an example on how to use a `.graphqlconfig` file further down.
|
||||
|
||||
### Identity template literal tag
|
||||
|
||||
This plugin relies on GraphQL queries being prefixed with a special tag. In Relay and Apollo, this is always done, but other clients often take query strings without a tag. In this case, you can define an identity tag that doesn't do anything except for tell the linter this is a GraphQL query:
|
||||
|
||||
```js
|
||||
global.gql = (literals, ...substitutions) => {
|
||||
let result = "";
|
||||
|
||||
// run the loop only for the substitution count
|
||||
for (let i = 0; i < substitutions.length; i++) {
|
||||
result += literals[i];
|
||||
result += substitutions[i];
|
||||
}
|
||||
|
||||
// add the last literal
|
||||
result += literals[literals.length - 1];
|
||||
|
||||
return result;
|
||||
}
|
||||
```
|
||||
|
||||
Code snippet taken from: <https://leanpub.com/understandinges6/read#leanpub-auto-multiline-strings>
|
||||
|
||||
Note: The linter rule could be extended to identify calls to various specific APIs to eliminate the need for a template literal tag, but this might just make the implementation a lot more complex for little benefit.
|
||||
|
||||
### GraphQL literal files
|
||||
|
||||
This plugin also lints GraphQL literal files ending on `.gql` or `.graphql`.
|
||||
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 --ext .gql --ext .graphql
|
||||
```
|
||||
|
||||
### Example config for Apollo
|
||||
|
||||
```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', 'fraql', 'literal'
|
||||
env: 'apollo',
|
||||
|
||||
// Import your schema JSON here
|
||||
schemaJson: require('./schema.json'),
|
||||
|
||||
// OR provide absolute path to your schema JSON (but not if using `eslint --cache`!)
|
||||
// schemaJsonFilepath: path.resolve(__dirname, './schema.json'),
|
||||
|
||||
// OR provide the schema in the Schema Language format
|
||||
// schemaString: printSchema(schema),
|
||||
|
||||
// tagName is gql by default
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Example config for Relay
|
||||
|
||||
```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', 'fraql', 'literal'
|
||||
env: 'relay',
|
||||
|
||||
// Import your schema JSON here
|
||||
schemaJson: require('./schema.json'),
|
||||
|
||||
// OR provide absolute path to your schema JSON (but not if using `eslint --cache`!)
|
||||
// schemaJsonFilepath: path.resolve(__dirname, './schema.json'),
|
||||
|
||||
// OR provide the schema in the Schema Language format
|
||||
// schemaString: printSchema(schema),
|
||||
|
||||
// tagName is set for you to Relay.QL
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Example config for Lokka
|
||||
|
||||
```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', 'fraql', 'literal'
|
||||
env: 'lokka',
|
||||
|
||||
// Import your schema JSON here
|
||||
schemaJson: require('./schema.json'),
|
||||
|
||||
// OR provide absolute path to your schema JSON (but not if using `eslint --cache`!)
|
||||
// schemaJsonFilepath: path.resolve(__dirname, './schema.json'),
|
||||
|
||||
// OR provide the schema in the Schema Language format
|
||||
// schemaString: printSchema(schema),
|
||||
|
||||
// Optional, the name of the template tag, defaults to 'gql'
|
||||
tagName: 'gql'
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Example config for FraQL
|
||||
|
||||
```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', 'fraql', 'literal'
|
||||
env: 'fraql',
|
||||
|
||||
// Import your schema JSON here
|
||||
schemaJson: require('./schema.json'),
|
||||
|
||||
// OR provide absolute path to your schema JSON
|
||||
// schemaJsonFilepath: path.resolve(__dirname, './schema.json'),
|
||||
|
||||
// OR provide the schema in the Schema Language format
|
||||
// schemaString: printSchema(schema),
|
||||
|
||||
// Optional, the name of the template tag, defaults to 'gql'
|
||||
tagName: 'gql'
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 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', 'fraql', 'literal'
|
||||
env: 'literal',
|
||||
|
||||
// Import your schema JSON here
|
||||
schemaJson: require('./schema.json'),
|
||||
|
||||
// OR provide absolute path to your schema JSON (but not if using `eslint --cache`!)
|
||||
// schemaJsonFilepath: path.resolve(__dirname, './schema.json'),
|
||||
|
||||
// OR provide the schema in the Schema Language format
|
||||
// schemaString: printSchema(schema),
|
||||
|
||||
// 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:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
parser: "babel-eslint",
|
||||
rules: {
|
||||
"graphql/template-strings": ['error', {
|
||||
env: 'apollo',
|
||||
tagName: 'FirstGQL',
|
||||
schemaJson: require('./schema-first.json')
|
||||
}, {
|
||||
env: 'relay',
|
||||
tagName: 'SecondGQL',
|
||||
schemaJson: require('./schema-second.json')
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Example config when using [.graphqlconfig](https://github.com/graphcool/graphql-config)
|
||||
|
||||
If you have `.graphqlconfig` file in the root of your repo you can omit schema-related
|
||||
properties (`schemaJson`, `schemaJsonFilepath` and `schemaString`) from rule config.
|
||||
|
||||
```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', 'fraql', 'literal'
|
||||
env: 'literal'
|
||||
// no need to specify schema here, it will be automatically determined using .graphqlconfig
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
In case you use additional schemas, specify `projectName` from `.graphqlconfig` for each `tagName`:
|
||||
```js
|
||||
module.exports = {
|
||||
parser: "babel-eslint",
|
||||
rules: {
|
||||
"graphql/template-strings": ['error', {
|
||||
env: 'apollo',
|
||||
tagName: 'FirstGQL',
|
||||
projectName: 'FirstGQLProject'
|
||||
}, {
|
||||
env: 'relay',
|
||||
tagName: 'SecondGQL',
|
||||
projectName: 'SecondGQLProject'
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Selecting Validation Rules
|
||||
|
||||
GraphQL validation rules can be configured in the eslint rule configuration using the `validators` option. The default selection depends on the `env` setting. If no `env` is specified, all rules are enabled by default.
|
||||
|
||||
The `validators` setting can be set either to a list of specific validator names or to the special value `"all"`.
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
parser: "babel-eslint",
|
||||
rules: {
|
||||
"graphql/template-strings": ['error', {
|
||||
env: 'apollo',
|
||||
validators: 'all',
|
||||
tagName: 'FirstGQL',
|
||||
schemaJson: require('./schema-first.json')
|
||||
}, {
|
||||
validators: ['FieldsOnCorrectType'],
|
||||
tagName: 'SecondGQL',
|
||||
schemaJson: require('./schema-second.json')
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The full list of available validators is:
|
||||
- `ExecutableDefinitions`
|
||||
- `FieldsOnCorrectType`
|
||||
- `FragmentsOnCompositeTypes`
|
||||
- `KnownArgumentNames`
|
||||
- `KnownDirectives` (*disabled by default in `relay`*)
|
||||
- `KnownFragmentNames` (*disabled by default in all envs*)
|
||||
- `KnownTypeNames`
|
||||
- `LoneAnonymousOperation`
|
||||
- `NoFragmentCycles`
|
||||
- `NoUndefinedVariables` (*disabled by default in `relay`*)
|
||||
- `NoUnusedFragments` (*disabled by default in all envs*)
|
||||
- `NoUnusedVariables`
|
||||
- `OverlappingFieldsCanBeMerged`
|
||||
- `PossibleFragmentSpreads`
|
||||
- `ProvidedRequiredArguments` (*disabled by default in `relay`*)
|
||||
- `ScalarLeafs` (*disabled by default in `relay`*)
|
||||
- `SingleFieldSubscriptions`
|
||||
- `UniqueArgumentNames`
|
||||
- `UniqueDirectivesPerLocation`
|
||||
- `UniqueFragmentNames`
|
||||
- `UniqueInputFieldNames`
|
||||
- `UniqueOperationNames`
|
||||
- `UniqueVariableNames`
|
||||
- `ValuesOfCorrectType`
|
||||
- `VariablesAreInputTypes`
|
||||
- `VariablesDefaultValueAllowed`
|
||||
- `VariablesInAllowedPosition`
|
||||
|
||||
### Named Operations Validation Rule
|
||||
|
||||
The Named Operation rule validates that all operations are named. Naming operations is valuable for including in server-side logs and debugging.
|
||||
|
||||
**Pass**
|
||||
```
|
||||
query FetchUsername {
|
||||
viewer {
|
||||
name
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Fail**
|
||||
```
|
||||
query {
|
||||
viewer {
|
||||
name
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The rule is defined as `graphql/named-operations`.
|
||||
|
||||
```js
|
||||
// In a file called .eslintrc.js
|
||||
module.exports = {
|
||||
parser: "babel-eslint",
|
||||
rules: {
|
||||
"graphql/template-strings": ['error', {
|
||||
env: 'apollo',
|
||||
schemaJson: require('./schema.json'),
|
||||
}],
|
||||
"graphql/named-operations": ['warn', {
|
||||
schemaJson: require('./schema.json'),
|
||||
}],
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
### Required Fields Validation Rule
|
||||
|
||||
The Required Fields rule validates that any specified required field is part of the query, but only if that field is available in schema. This is useful to ensure that query results are cached properly in the client.
|
||||
|
||||
**Pass**
|
||||
```
|
||||
// 'uuid' required and present in the schema
|
||||
|
||||
schema {
|
||||
query {
|
||||
viewer {
|
||||
name
|
||||
uuid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query ViewerName {
|
||||
viewer {
|
||||
name
|
||||
uuid
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Pass**
|
||||
```
|
||||
// 'uuid' usually required but not present in the schema here
|
||||
|
||||
schema {
|
||||
query {
|
||||
viewer {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query ViewerName {
|
||||
viewer {
|
||||
name
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Fail**
|
||||
```
|
||||
// 'uuid' required and present in the schema
|
||||
|
||||
schema {
|
||||
query {
|
||||
viewer {
|
||||
uuid
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query ViewerName {
|
||||
viewer {
|
||||
name
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The rule is defined as `graphql/required-fields` and requires the `requiredFields` option.
|
||||
|
||||
```js
|
||||
// In a file called .eslintrc.js
|
||||
module.exports = {
|
||||
rules: {
|
||||
'graphql/required-fields': [
|
||||
'error',
|
||||
{
|
||||
env: 'apollo',
|
||||
schemaJsonFilepath: path.resolve(__dirname, './schema.json'),
|
||||
requiredFields: ['uuid'],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Capitalization of a first letter of a Type name
|
||||
|
||||
This rule enforces that first letter of types is capitalized
|
||||
|
||||
**Pass**
|
||||
```
|
||||
query {
|
||||
someUnion {
|
||||
... on SomeType {
|
||||
someField
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Fail**
|
||||
```
|
||||
query {
|
||||
someUnion {
|
||||
... on someType {
|
||||
someField
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The rule is defined as `graphql/capitalized-type-name`.
|
||||
|
||||
```js
|
||||
// In a file called .eslintrc.js
|
||||
module.exports = {
|
||||
parser: "babel-eslint",
|
||||
rules: {
|
||||
"graphql/template-strings": ['error', {
|
||||
env: 'apollo',
|
||||
schemaJson: require('./schema.json'),
|
||||
}],
|
||||
"graphql/capitalized-type-name": ['warn', {
|
||||
schemaJson: require('./schema.json'),
|
||||
}],
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### No Deprecated Fields Validation Rule
|
||||
|
||||
The No Deprecated Fields rule validates that no deprecated fields are part of the query. This is useful to discover fields that have been marked as deprecated and shouldn't be used.
|
||||
|
||||
**Fail**
|
||||
```
|
||||
// 'id' requested and marked as deprecated in the schema
|
||||
|
||||
schema {
|
||||
query {
|
||||
viewer {
|
||||
id: Int @deprecated(reason: "Use the 'uuid' field instead")
|
||||
uuid: String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query ViewerName {
|
||||
viewer {
|
||||
id
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The rule is defined as `graphql/no-deprecated-fields`.
|
||||
|
||||
```js
|
||||
// In a file called .eslintrc.js
|
||||
module.exports = {
|
||||
rules: {
|
||||
'graphql/no-deprecated-fields': [
|
||||
'error',
|
||||
{
|
||||
env: 'relay',
|
||||
schemaJson: require('./schema.json')
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
'graphql'
|
||||
]
|
||||
}
|
||||
```
|
||||
6
node_modules/eslint-plugin-graphql/lib/constants.js
generated
vendored
Normal file
6
node_modules/eslint-plugin-graphql/lib/constants.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var internalTag = exports.internalTag = 'ESLintPluginGraphQLFile';
|
||||
245
node_modules/eslint-plugin-graphql/lib/createRule.js
generated
vendored
Normal file
245
node_modules/eslint-plugin-graphql/lib/createRule.js
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createRule = createRule;
|
||||
|
||||
var _graphql = require('graphql');
|
||||
|
||||
var _constants = require('./constants');
|
||||
|
||||
function strWithLen(len) {
|
||||
// from http://stackoverflow.com/questions/14343844/create-a-string-of-variable-length-filled-with-a-repeated-character
|
||||
return new Array(len + 1).join('x');
|
||||
}
|
||||
|
||||
function replaceExpressions(node, context, env) {
|
||||
var chunks = [];
|
||||
|
||||
node.quasis.forEach(function (element, i) {
|
||||
var chunk = element.value.cooked;
|
||||
var value = node.expressions[i];
|
||||
|
||||
chunks.push(chunk);
|
||||
|
||||
if (!env || env === 'apollo') {
|
||||
// In Apollo, interpolation is only valid outside top-level structures like `query` or `mutation`.
|
||||
// We'll check to make sure there's an equivalent set of opening and closing brackets, otherwise
|
||||
// we're attempting to do an invalid interpolation.
|
||||
if (chunk.split('{').length - 1 !== chunk.split('}').length - 1) {
|
||||
context.report({
|
||||
node: value,
|
||||
message: 'Invalid interpolation - fragment interpolation must occur outside of the brackets.'
|
||||
});
|
||||
throw new Error('Invalid interpolation');
|
||||
}
|
||||
}
|
||||
|
||||
if (!element.tail) {
|
||||
// Preserve location of errors by replacing with exactly the same length
|
||||
var nameLength = value.end - value.start;
|
||||
|
||||
if (env === 'relay' && /:\s*$/.test(chunk)) {
|
||||
// The chunk before this one had a colon at the end, so this
|
||||
// is a variable
|
||||
|
||||
// Add 2 for brackets in the interpolation
|
||||
var placeholder = strWithLen(nameLength + 2);
|
||||
chunks.push('$' + placeholder);
|
||||
} else if (env === 'lokka' && /\.\.\.\s*$/.test(chunk)) {
|
||||
// This is Lokka-style fragment interpolation where you actually type the '...' yourself
|
||||
var _placeholder = strWithLen(nameLength + 3);
|
||||
chunks.push(_placeholder);
|
||||
} else if (env === 'relay') {
|
||||
// This is Relay-style fragment interpolation where you don't type '...'
|
||||
// Ellipsis cancels out extra characters
|
||||
var _placeholder2 = strWithLen(nameLength);
|
||||
chunks.push('...' + _placeholder2);
|
||||
} else if (!env || env === 'apollo') {
|
||||
// In Apollo, fragment interpolation is only valid outside of brackets
|
||||
// Since we don't know what we'd interpolate here (that occurs at runtime),
|
||||
// we're not going to do anything with this interpolation.
|
||||
} else if (env === 'fraql') {
|
||||
if (chunk.lastIndexOf('{') > chunk.lastIndexOf('}')) {
|
||||
chunks.push('__typename');
|
||||
}
|
||||
} else {
|
||||
// Invalid interpolation
|
||||
context.report({
|
||||
node: value,
|
||||
message: 'Invalid interpolation - not a valid fragment or variable.'
|
||||
});
|
||||
throw new Error('Invalid interpolation');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return chunks.join('');
|
||||
}
|
||||
|
||||
function locFrom(node, error) {
|
||||
if (!error.locations || !error.locations.length) {
|
||||
return;
|
||||
}
|
||||
var location = error.locations[0];
|
||||
|
||||
var line = void 0;
|
||||
var column = void 0;
|
||||
if (location.line === 1 && node.tag.name !== _constants.internalTag) {
|
||||
line = node.loc.start.line;
|
||||
column = node.tag.loc.end.column + location.column;
|
||||
} else {
|
||||
line = node.loc.start.line + location.line - 1;
|
||||
column = location.column - 1;
|
||||
}
|
||||
|
||||
return {
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
}
|
||||
|
||||
function handleTemplateTag(node, context, schema, env, validators) {
|
||||
var text = void 0;
|
||||
try {
|
||||
text = replaceExpressions(node.quasi, context, env);
|
||||
} catch (e) {
|
||||
if (e.message !== 'Invalid interpolation') {
|
||||
console.log(e); // eslint-disable-line no-console
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Re-implement syntax sugar for fragment names, which is technically not valid
|
||||
// graphql
|
||||
if ((env === 'lokka' || env === 'relay' || env === 'fraql') && /fragment\s+on/.test(text)) {
|
||||
text = text.replace('fragment', 'fragment _');
|
||||
}
|
||||
|
||||
var ast = void 0;
|
||||
|
||||
try {
|
||||
ast = (0, _graphql.parse)(text);
|
||||
} catch (error) {
|
||||
context.report({
|
||||
node: node,
|
||||
message: error.message.split('\n')[0],
|
||||
loc: locFrom(node, error)
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var validationErrors = schema ? (0, _graphql.validate)(schema, ast, validators) : [];
|
||||
if (validationErrors && validationErrors.length > 0) {
|
||||
context.report({
|
||||
node: node,
|
||||
message: validationErrors[0].message,
|
||||
loc: locFrom(node, validationErrors[0])
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function templateExpressionMatchesTag(tagName, node) {
|
||||
var tagNameSegments = tagName.split('.').length;
|
||||
if (tagNameSegments === 1) {
|
||||
// Check for single identifier, like 'gql'
|
||||
if (node.tag.type !== 'Identifier' || node.tag.name !== tagName) {
|
||||
return false;
|
||||
}
|
||||
} else if (tagNameSegments === 2) {
|
||||
// Check for dotted identifier, like 'Relay.QL'
|
||||
if (node.tag.type !== 'MemberExpression' || node.tag.object.name + '.' + node.tag.property.name !== tagName) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// We don't currently support 3 segments so ignore
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function createRule(context, optionParser) {
|
||||
var tagNames = new Set();
|
||||
var tagRules = [];
|
||||
var options = context.options.length === 0 ? [{}] : context.options;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
var _loop = function _loop() {
|
||||
var optionGroup = _step.value;
|
||||
|
||||
var _optionParser = optionParser(optionGroup),
|
||||
schema = _optionParser.schema,
|
||||
env = _optionParser.env,
|
||||
tagName = _optionParser.tagName,
|
||||
validators = _optionParser.validators;
|
||||
|
||||
var boundValidators = validators.map(function (v) {
|
||||
return function (ctx) {
|
||||
return v(ctx, optionGroup);
|
||||
};
|
||||
});
|
||||
if (tagNames.has(tagName)) {
|
||||
throw new Error('Multiple options for GraphQL tag ' + tagName);
|
||||
}
|
||||
tagNames.add(tagName);
|
||||
tagRules.push({ schema: schema, env: env, tagName: tagName, validators: boundValidators });
|
||||
};
|
||||
|
||||
for (var _iterator = options[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
_loop();
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
TaggedTemplateExpression: function TaggedTemplateExpression(node) {
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = tagRules[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var _ref2 = _step2.value;
|
||||
var schema = _ref2.schema,
|
||||
env = _ref2.env,
|
||||
tagName = _ref2.tagName,
|
||||
validators = _ref2.validators;
|
||||
|
||||
if (templateExpressionMatchesTag(tagName, node)) {
|
||||
return handleTemplateTag(node, context, schema, env, validators);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
158
node_modules/eslint-plugin-graphql/lib/customGraphQLValidationRules.js
generated
vendored
Normal file
158
node_modules/eslint-plugin-graphql/lib/customGraphQLValidationRules.js
generated
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.OperationsMustHaveNames = OperationsMustHaveNames;
|
||||
exports.RequiredFields = RequiredFields;
|
||||
exports.typeNamesShouldBeCapitalized = typeNamesShouldBeCapitalized;
|
||||
exports.noDeprecatedFields = noDeprecatedFields;
|
||||
|
||||
var _graphql = require("graphql");
|
||||
|
||||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||||
|
||||
function OperationsMustHaveNames(context) {
|
||||
return {
|
||||
OperationDefinition: function OperationDefinition(node) {
|
||||
if (!node.name) {
|
||||
context.reportError(new _graphql.GraphQLError("All operations must be named", [node]));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getFieldWasRequestedOnNode(node, field) {
|
||||
return node.selectionSet.selections.some(function (n) {
|
||||
return n.kind === "Field" && n.name.value === field;
|
||||
});
|
||||
}
|
||||
|
||||
function fieldAvailableOnType(type, field) {
|
||||
return type && type._fields && type._fields[field] || type.ofType && fieldAvailableOnType(type.ofType, field);
|
||||
}
|
||||
|
||||
function RequiredFields(context, options) {
|
||||
var requiredFields = options.requiredFields;
|
||||
|
||||
|
||||
return {
|
||||
FragmentDefinition: function FragmentDefinition(node) {
|
||||
requiredFields.forEach(function (field) {
|
||||
var type = context.getType();
|
||||
|
||||
if (fieldAvailableOnType(type, field)) {
|
||||
var fieldWasRequested = getFieldWasRequestedOnNode(node, field);
|
||||
if (!fieldWasRequested) {
|
||||
context.reportError(new _graphql.GraphQLError("'" + field + "' field required on 'fragment " + node.name.value + " on " + node.typeCondition.name.value + "'", [node]));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// Every inline fragment must have the required field specified inside
|
||||
// itself or in some parent selection set.
|
||||
InlineFragment: function InlineFragment(node, key, parent, path, ancestors) {
|
||||
requiredFields.forEach(function (field) {
|
||||
var type = context.getType();
|
||||
|
||||
if (fieldAvailableOnType(type, field)) {
|
||||
// First, check the selection set on this inline fragment
|
||||
if (node.selectionSet && getFieldWasRequestedOnNode(node, field)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var ancestorClone = [].concat(_toConsumableArray(ancestors));
|
||||
|
||||
var nearestField = void 0;
|
||||
var nextAncestor = void 0;
|
||||
|
||||
// Now, walk up the ancestors, until you see a field.
|
||||
while (!nearestField) {
|
||||
nextAncestor = ancestorClone.pop();
|
||||
|
||||
if (nextAncestor.selectionSet && getFieldWasRequestedOnNode(nextAncestor, field)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (nextAncestor.kind === "Field") {
|
||||
nearestField = nextAncestor;
|
||||
}
|
||||
}
|
||||
|
||||
// If we never found a field, the query is malformed
|
||||
if (!nearestField) {
|
||||
throw new Error("Inline fragment found inside document without a parent field.");
|
||||
}
|
||||
|
||||
// We found a field, but we never saw the field we were looking for in
|
||||
// the intermediate selection sets.
|
||||
context.reportError(new _graphql.GraphQLError("'" + field + "' field required on '... on " + node.typeCondition.name.value + "'", [node]));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// Every field that can have the field directly on it, should. It's not
|
||||
// enough to have some child fragment to include the field, since we don't
|
||||
// know if that fragment covers all of the possible type options.
|
||||
Field: function Field(node) {
|
||||
var def = context.getFieldDef();
|
||||
if (!def) {
|
||||
return;
|
||||
}
|
||||
|
||||
requiredFields.forEach(function (field) {
|
||||
if (fieldAvailableOnType(def.type, field)) {
|
||||
var fieldWasRequested = getFieldWasRequestedOnNode(node, field);
|
||||
if (!fieldWasRequested) {
|
||||
context.reportError(new _graphql.GraphQLError("'" + field + "' field required on '" + node.name.value + "'", [node]));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function typeNamesShouldBeCapitalized(context) {
|
||||
return {
|
||||
NamedType: function NamedType(node) {
|
||||
var typeName = node.name.value;
|
||||
if (typeName[0] == typeName[0].toLowerCase()) {
|
||||
context.reportError(new _graphql.GraphQLError("All type names should start with a capital letter", [node]));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Mostly taken from https://github.com/graphql/graphql-js/blob/063148de039b02670a760b8d3dfaf2a04a467169/src/utilities/findDeprecatedUsages.js
|
||||
// See explanation in [#93](https://github.com/apollographql/eslint-plugin-graphql/pull/93)
|
||||
function noDeprecatedFields(context) {
|
||||
return {
|
||||
Field: function Field(node) {
|
||||
var fieldDef = context.getFieldDef();
|
||||
if (fieldDef && fieldDef.isDeprecated) {
|
||||
var parentType = context.getParentType();
|
||||
if (parentType) {
|
||||
var reason = fieldDef.deprecationReason;
|
||||
context.reportError(new _graphql.GraphQLError("The field " + parentType.name + "." + fieldDef.name + " is deprecated." + (reason ? " " + reason : ""), [node]));
|
||||
}
|
||||
}
|
||||
},
|
||||
EnumValue: function EnumValue(node) {
|
||||
// context is of type ValidationContext which doesn't export getEnumValue.
|
||||
// Bypass the public API to grab that information directly from _typeInfo.
|
||||
var enumVal = context._typeInfo.getEnumValue();
|
||||
if (enumVal && enumVal.isDeprecated) {
|
||||
var type = (0, _graphql.getNamedType)(context.getInputType());
|
||||
if (!type) {
|
||||
return;
|
||||
}
|
||||
|
||||
var reason = enumVal.deprecationReason;
|
||||
context.reportError(new _graphql.GraphQLError("The enum value " + type.name + "." + enumVal.name + " is deprecated." + (reason ? " " + reason : ""), [node]));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
355
node_modules/eslint-plugin-graphql/lib/index.js
generated
vendored
Normal file
355
node_modules/eslint-plugin-graphql/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,355 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.processors = exports.rules = undefined;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _fs = require('fs');
|
||||
|
||||
var _fs2 = _interopRequireDefault(_fs);
|
||||
|
||||
var _path = require('path');
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
var _graphql = require('graphql');
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _graphqlConfig = require('graphql-config');
|
||||
|
||||
var _customGraphQLValidationRules = require('./customGraphQLValidationRules');
|
||||
|
||||
var customRules = _interopRequireWildcard(_customGraphQLValidationRules);
|
||||
|
||||
var _constants = require('./constants');
|
||||
|
||||
var _createRule = require('./createRule');
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
var allGraphQLValidatorNames = _graphql.specifiedRules.map(function (rule) {
|
||||
return rule.name;
|
||||
});
|
||||
|
||||
// Map of env name to list of rule names.
|
||||
var envGraphQLValidatorNames = {
|
||||
apollo: (0, _lodash.without)(allGraphQLValidatorNames, 'KnownFragmentNames', 'NoUnusedFragments'),
|
||||
lokka: (0, _lodash.without)(allGraphQLValidatorNames, 'KnownFragmentNames', 'NoUnusedFragments'),
|
||||
fraql: (0, _lodash.without)(allGraphQLValidatorNames, 'KnownFragmentNames', 'NoUnusedFragments'),
|
||||
relay: (0, _lodash.without)(allGraphQLValidatorNames, 'KnownDirectives', 'KnownFragmentNames', 'NoUndefinedVariables', 'NoUnusedFragments',
|
||||
// `graphql` < 14
|
||||
'ProvidedNonNullArguments',
|
||||
// `graphql`@14
|
||||
'ProvidedRequiredArguments', 'ScalarLeafs'),
|
||||
literal: (0, _lodash.without)(allGraphQLValidatorNames, 'KnownFragmentNames', 'NoUnusedFragments')
|
||||
};
|
||||
|
||||
var gqlFiles = ['gql', 'graphql'];
|
||||
|
||||
var defaultRuleProperties = {
|
||||
env: {
|
||||
enum: ['lokka', 'fraql', 'relay', 'apollo', 'literal']
|
||||
},
|
||||
schemaJson: {
|
||||
type: 'object'
|
||||
},
|
||||
schemaJsonFilepath: {
|
||||
type: 'string'
|
||||
},
|
||||
schemaString: {
|
||||
type: 'string'
|
||||
},
|
||||
tagName: {
|
||||
type: 'string',
|
||||
pattern: '^[$_a-zA-Z$_][a-zA-Z0-9$_]+(\\.[a-zA-Z0-9$_]+)?$'
|
||||
},
|
||||
projectName: {
|
||||
type: 'string'
|
||||
}
|
||||
|
||||
// schemaJson, schemaJsonFilepath, schemaString and projectName are mutually exclusive:
|
||||
};var schemaPropsExclusiveness = {
|
||||
oneOf: [{
|
||||
required: ['schemaJson'],
|
||||
not: { required: ['schemaString', 'schemaJsonFilepath', 'projectName'] }
|
||||
}, {
|
||||
required: ['schemaJsonFilepath'],
|
||||
not: { required: ['schemaJson', 'schemaString', 'projectName'] }
|
||||
}, {
|
||||
required: ['schemaString'],
|
||||
not: { required: ['schemaJson', 'schemaJsonFilepath', 'projectName'] }
|
||||
}, {
|
||||
not: {
|
||||
anyOf: [{ required: ['schemaString'] }, { required: ['schemaJson'] }, { required: ['schemaJsonFilepath'] }]
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
var rules = exports.rules = {
|
||||
'template-strings': {
|
||||
meta: {
|
||||
schema: {
|
||||
type: 'array',
|
||||
items: _extends({
|
||||
additionalProperties: false,
|
||||
properties: _extends({}, defaultRuleProperties, {
|
||||
validators: {
|
||||
oneOf: [{
|
||||
type: 'array',
|
||||
uniqueItems: true,
|
||||
items: {
|
||||
enum: allGraphQLValidatorNames
|
||||
}
|
||||
}, {
|
||||
enum: ['all']
|
||||
}]
|
||||
}
|
||||
})
|
||||
}, schemaPropsExclusiveness)
|
||||
}
|
||||
},
|
||||
create: function create(context) {
|
||||
return (0, _createRule.createRule)(context, function (optionGroup) {
|
||||
return parseOptions(optionGroup, context);
|
||||
});
|
||||
}
|
||||
},
|
||||
'named-operations': {
|
||||
meta: {
|
||||
schema: {
|
||||
type: 'array',
|
||||
items: _extends({
|
||||
additionalProperties: false,
|
||||
properties: _extends({}, defaultRuleProperties)
|
||||
}, schemaPropsExclusiveness)
|
||||
}
|
||||
},
|
||||
create: function create(context) {
|
||||
return (0, _createRule.createRule)(context, function (optionGroup) {
|
||||
return parseOptions(_extends({
|
||||
validators: ['OperationsMustHaveNames']
|
||||
}, optionGroup), context);
|
||||
});
|
||||
}
|
||||
},
|
||||
'required-fields': {
|
||||
meta: {
|
||||
schema: {
|
||||
type: 'array',
|
||||
minItems: 1,
|
||||
items: _extends({
|
||||
additionalProperties: false,
|
||||
properties: _extends({}, defaultRuleProperties, {
|
||||
requiredFields: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
}),
|
||||
required: ['requiredFields']
|
||||
}, schemaPropsExclusiveness)
|
||||
}
|
||||
},
|
||||
create: function create(context) {
|
||||
return (0, _createRule.createRule)(context, function (optionGroup) {
|
||||
return parseOptions(_extends({
|
||||
validators: ['RequiredFields'],
|
||||
options: { requiredFields: optionGroup.requiredFields }
|
||||
}, optionGroup), context);
|
||||
});
|
||||
}
|
||||
},
|
||||
'capitalized-type-name': {
|
||||
meta: {
|
||||
schema: {
|
||||
type: 'array',
|
||||
items: _extends({
|
||||
additionalProperties: false,
|
||||
properties: _extends({}, defaultRuleProperties)
|
||||
}, schemaPropsExclusiveness)
|
||||
}
|
||||
},
|
||||
create: function create(context) {
|
||||
return (0, _createRule.createRule)(context, function (optionGroup) {
|
||||
return parseOptions(_extends({
|
||||
validators: ['typeNamesShouldBeCapitalized']
|
||||
}, optionGroup), context);
|
||||
});
|
||||
}
|
||||
},
|
||||
'no-deprecated-fields': {
|
||||
meta: {
|
||||
schema: {
|
||||
type: 'array',
|
||||
items: _extends({
|
||||
additionalProperties: false,
|
||||
properties: _extends({}, defaultRuleProperties)
|
||||
}, schemaPropsExclusiveness)
|
||||
}
|
||||
},
|
||||
create: function create(context) {
|
||||
return (0, _createRule.createRule)(context, function (optionGroup) {
|
||||
return parseOptions(_extends({
|
||||
validators: ['noDeprecatedFields']
|
||||
}, optionGroup), context);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var schemaCache = {};
|
||||
var projectCache = {};
|
||||
|
||||
function parseOptions(optionGroup, context) {
|
||||
var schemaJson = optionGroup.schemaJson,
|
||||
schemaJsonFilepath = optionGroup.schemaJsonFilepath,
|
||||
schemaString = optionGroup.schemaString,
|
||||
env = optionGroup.env,
|
||||
projectName = optionGroup.projectName,
|
||||
tagNameOption = optionGroup.tagName,
|
||||
validatorNamesOption = optionGroup.validators;
|
||||
|
||||
|
||||
var cacheHit = schemaCache[JSON.stringify(optionGroup)];
|
||||
if (cacheHit && env !== 'literal') {
|
||||
return cacheHit;
|
||||
}
|
||||
|
||||
// Validate and unpack schema
|
||||
var schema = void 0;
|
||||
if (schemaJson) {
|
||||
schema = initSchema(schemaJson);
|
||||
} else if (schemaJsonFilepath) {
|
||||
schema = initSchemaFromFile(schemaJsonFilepath);
|
||||
} else if (schemaString) {
|
||||
schema = initSchemaFromString(schemaString);
|
||||
} else {
|
||||
try {
|
||||
var config = (0, _graphqlConfig.getGraphQLConfig)(_path2.default.dirname(context.getFilename()));
|
||||
var projectConfig = void 0;
|
||||
if (projectName) {
|
||||
projectConfig = config.getProjects()[projectName];
|
||||
if (!projectConfig) {
|
||||
throw new Error('Project with name "' + projectName + '" not found in ' + config.configPath + '.');
|
||||
}
|
||||
} else {
|
||||
projectConfig = config.getConfigForFile(context.getFilename());
|
||||
}
|
||||
if (projectConfig) {
|
||||
var key = config.configPath + '[' + projectConfig.projectName + ']';
|
||||
schema = projectCache[key];
|
||||
if (!schema) {
|
||||
schema = projectConfig.getSchema();
|
||||
projectCache[key] = schema;
|
||||
}
|
||||
}
|
||||
if (cacheHit) {
|
||||
return _extends({}, cacheHit, { schema: schema });
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof _graphqlConfig.ConfigNotFoundError) {
|
||||
throw new Error('Must provide .graphqlconfig file or pass in `schemaJson` option ' + 'with schema object or `schemaJsonFilepath` with absolute path to the json file.');
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Validate env
|
||||
if (env && env !== 'lokka' && env !== 'fraql' && env !== 'relay' && env !== 'apollo' && env !== 'literal') {
|
||||
throw new Error('Invalid option for env, only `apollo`, `lokka`, `fraql`, `relay`, and `literal` supported.');
|
||||
}
|
||||
|
||||
// Validate tagName and set default
|
||||
var tagName = void 0;
|
||||
if (tagNameOption) {
|
||||
tagName = tagNameOption;
|
||||
} else if (env === 'relay') {
|
||||
tagName = 'Relay.QL';
|
||||
} else if (env === 'literal') {
|
||||
tagName = _constants.internalTag;
|
||||
} else {
|
||||
tagName = 'gql';
|
||||
}
|
||||
|
||||
// The validator list may be:
|
||||
// The string 'all' to use all rules.
|
||||
// An array of rule names.
|
||||
// null/undefined to use the default rule set of the environment, or all rules.
|
||||
var validatorNames = void 0;
|
||||
if (validatorNamesOption === 'all') {
|
||||
validatorNames = allGraphQLValidatorNames;
|
||||
} else if (validatorNamesOption) {
|
||||
validatorNames = validatorNamesOption;
|
||||
} else {
|
||||
validatorNames = envGraphQLValidatorNames[env] || allGraphQLValidatorNames;
|
||||
}
|
||||
|
||||
var validators = validatorNames.map(function (name) {
|
||||
if (name in customRules) {
|
||||
return customRules[name];
|
||||
} else {
|
||||
return require('graphql/validation/rules/' + name)[name];
|
||||
}
|
||||
});
|
||||
var results = { schema: schema, env: env, tagName: tagName, validators: validators };
|
||||
schemaCache[JSON.stringify(optionGroup)] = results;
|
||||
return results;
|
||||
}
|
||||
|
||||
function initSchema(json) {
|
||||
var unpackedSchemaJson = json.data ? json.data : json;
|
||||
if (!unpackedSchemaJson.__schema) {
|
||||
throw new Error('Please pass a valid GraphQL introspection query result.');
|
||||
}
|
||||
return (0, _graphql.buildClientSchema)(unpackedSchemaJson);
|
||||
}
|
||||
|
||||
function initSchemaFromFile(jsonFile) {
|
||||
return initSchema(JSON.parse(_fs2.default.readFileSync(jsonFile, 'utf8')));
|
||||
}
|
||||
|
||||
function initSchemaFromString(source) {
|
||||
return (0, _graphql.buildSchema)(source);
|
||||
}
|
||||
|
||||
var gqlProcessor = {
|
||||
preprocess: function preprocess(text) {
|
||||
// Wrap the text in backticks and prepend the internal tag. First the text
|
||||
// must be escaped, because of the three sequences that have special
|
||||
// meaning in JavaScript template literals, and could change the meaning of
|
||||
// the text or cause syntax errors.
|
||||
// https://tc39.github.io/ecma262/#prod-TemplateCharacter
|
||||
//
|
||||
// - "`" would end the template literal.
|
||||
// - "\" would start an escape sequence.
|
||||
// - "${" would start an interpolation.
|
||||
var escaped = text.replace(/[`\\]|\$\{/g, '\\$&');
|
||||
return [_constants.internalTag + '`' + escaped + '`'];
|
||||
},
|
||||
postprocess: function postprocess(messages) {
|
||||
// only report graphql-errors
|
||||
return (0, _lodash.flatten)(messages).filter(function (message) {
|
||||
return (0, _lodash.includes)((0, _lodash.keys)(rules).map(function (key) {
|
||||
return 'graphql/' + key;
|
||||
}), message.ruleId);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var processors = exports.processors = (0, _lodash.reduce)(gqlFiles, function (result, value) {
|
||||
return _extends({}, result, _defineProperty({}, '.' + value, gqlProcessor));
|
||||
}, {});
|
||||
|
||||
exports.default = {
|
||||
rules: rules,
|
||||
processors: processors
|
||||
};
|
||||
79
node_modules/eslint-plugin-graphql/package.json
generated
vendored
Normal file
79
node_modules/eslint-plugin-graphql/package.json
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
"_from": "eslint-plugin-graphql@^3.0.3",
|
||||
"_id": "eslint-plugin-graphql@3.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-hHwLyxSkC5rkakJ/SNTWwOswPdVhvfyMCnEOloevrLQIOHUNVIQBg1ljCaRe9C40HdzgcGUFUdG5BHLCKm8tuw==",
|
||||
"_location": "/eslint-plugin-graphql",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "eslint-plugin-graphql@^3.0.3",
|
||||
"name": "eslint-plugin-graphql",
|
||||
"escapedName": "eslint-plugin-graphql",
|
||||
"rawSpec": "^3.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gatsby"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/eslint-plugin-graphql/-/eslint-plugin-graphql-3.0.3.tgz",
|
||||
"_shasum": "9ecdaf5ea8397973e29cea9dbf860420694e9df0",
|
||||
"_spec": "eslint-plugin-graphql@^3.0.3",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/gatsby",
|
||||
"author": {
|
||||
"name": "Sashko Stubailo"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
"es2015",
|
||||
"stage-0"
|
||||
]
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollostack/eslint-plugin-graphql/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"graphql-config": "^2.0.1",
|
||||
"lodash": "^4.11.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "GraphQL ESLint plugin.",
|
||||
"devDependencies": {
|
||||
"babel-cli": "6.26.0",
|
||||
"babel-core": "6.26.3",
|
||||
"babel-eslint": "10.0.1",
|
||||
"babel-plugin-transform-runtime": "6.23.0",
|
||||
"babel-preset-es2015": "6.24.1",
|
||||
"babel-preset-stage-0": "6.24.1",
|
||||
"eslint": "5.12.1",
|
||||
"graphql": "14.1.1",
|
||||
"graphql-tools": "4.0.4",
|
||||
"mocha": "5.2.0",
|
||||
"test-all-versions": "3.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"homepage": "https://github.com/apollostack/eslint-plugin-graphql",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "eslint-plugin-graphql",
|
||||
"peerDependencies": {
|
||||
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/apollostack/eslint-plugin-graphql.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint 'src/**/*.js' 'test/**/*.js'",
|
||||
"prepublish": "babel ./src --ignore test --out-dir ./lib",
|
||||
"pretest": "node test/updateSchemaJson.js",
|
||||
"tav": "tav",
|
||||
"test": "tav --ci && mocha test/index.js"
|
||||
},
|
||||
"version": "3.0.3"
|
||||
}
|
||||
5
node_modules/eslint-plugin-graphql/renovate.json
generated
vendored
Normal file
5
node_modules/eslint-plugin-graphql/renovate.json
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
]
|
||||
}
|
||||
BIN
node_modules/eslint-plugin-graphql/screenshot.png
generated
vendored
Normal file
BIN
node_modules/eslint-plugin-graphql/screenshot.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
Reference in New Issue
Block a user