diff --git a/.babelrc.js b/.babelrc.js index d35eff79a4..4af2b5dae4 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -9,14 +9,10 @@ module.exports = { ], env: { cjs: { - presets: [ - ['@babel/preset-env', { modules: 'commonjs' }], - ], + presets: [['@babel/preset-env', { modules: 'commonjs' }]], }, mjs: { - presets: [ - ['@babel/preset-env', { modules: false }], - ], + presets: [['@babel/preset-env', { modules: false }]], }, }, }; diff --git a/.eslintrc.yml b/.eslintrc.yml index d9a13b5dac..9f8b14af02 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -6,12 +6,8 @@ env: node: true plugins: - flowtype - - prettier rules: - # https://github.com/prettier/eslint-plugin-prettier#installation - prettier/prettier: error - # `eslint-plugin-flowtype` rule list based on `v3.11.x` # https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype @@ -35,7 +31,8 @@ rules: flowtype/require-readonly-react-props: off flowtype/require-return-type: off flowtype/require-types-at-top: off - flowtype/require-valid-file-annotation: [error, always, { annotationStyle: line, strict: true }] + flowtype/require-valid-file-annotation: + [error, always, { annotationStyle: line, strict: true }] flowtype/require-variable-type: off flowtype/sort-keys: off flowtype/spread-exact-type: off @@ -130,7 +127,7 @@ rules: no-implied-eval: error no-invalid-this: off no-iterator: error - no-labels: [error, {allowLoop: true}] + no-labels: [error, { allowLoop: true }] no-lone-blocks: error no-loop-func: error no-magic-numbers: off @@ -168,7 +165,7 @@ rules: require-await: off # TODO require-unicode-regexp: off vars-on-top: error - yoda: [error, never, {exceptRange: true}] + yoda: [error, never, { exceptRange: true }] # Strict Mode # https://eslint.org/docs/rules/#strict-mode @@ -187,7 +184,8 @@ rules: no-undef: error no-undef-init: error no-undefined: off - no-unused-vars: [error, {vars: all, args: after-used, argsIgnorePattern: "^_"}] + no-unused-vars: + [error, { vars: all, args: after-used, argsIgnorePattern: '^_' }] no-use-before-define: off # Node.js and CommonJS @@ -208,7 +206,7 @@ rules: # Stylistic Issues # https://eslint.org/docs/rules/#stylistic-issues - camelcase: [error, {properties: always}] + camelcase: [error, { properties: always }] capitalized-comments: off # maybe consistent-this: off func-name-matching: off @@ -216,7 +214,7 @@ rules: func-style: off id-blacklist: off id-length: off - id-match: [error, "^(?:_?[a-zA-Z0-9]*)|[_A-Z0-9]+$"] + id-match: [error, '^(?:_?[a-zA-Z0-9]*)|[_A-Z0-9]+$'] line-comment-position: off lines-around-comment: off lines-between-class-members: [error, always, { exceptAfterSingleLine: true }] @@ -353,10 +351,10 @@ rules: yield-star-spacing: off overrides: - - files: "**/__tests__/**" + - files: '**/__tests__/**' rules: no-restricted-syntax: off - - files: "resources/**" + - files: 'resources/**' parserOptions: sourceType: script rules: diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fdbccf9802..0dd32f2d63 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,5 +1,4 @@ -Contributing to graphql-js -========================== +# Contributing to graphql-js We want to make contributing to this project as easy and transparent as possible. Hopefully this document makes the process for contributing clear and @@ -72,23 +71,23 @@ This will watch the file system run any relevant lint, tests, and type checks au This project uses [Prettier](https://prettier.io/) for standard formatting. To ensure your pull request matches the style guides, run `npm run prettier`. -* 2 spaces for indentation (no tabs) -* 80 character line length strongly preferred. -* Prefer `'` over `"` -* ES6 syntax when possible. However do not rely on ES6-specific functions to be available. -* Use [Flow types](https://flowtype.org/). -* Use semicolons; -* Trailing commas, -* Avd abbr wrds. +- 2 spaces for indentation (no tabs) +- 80 character line length strongly preferred. +- Prefer `'` over `"` +- ES6 syntax when possible. However do not rely on ES6-specific functions to be available. +- Use [Flow types](https://flowtype.org/). +- Use semicolons; +- Trailing commas, +- Avd abbr wrds. ## Release on NPM -*Only core contributors may release to NPM.* +_Only core contributors may release to NPM._ To release a new version on NPM, first ensure all tests pass with `npm test`, then use `npm version patch|minor|major` in order to increment the version in package.json and tag and commit a release. Then `git push && git push --tags` -this change so Travis CI can deploy to NPM. *Do not run `npm publish` directly.* +this change so Travis CI can deploy to NPM. _Do not run `npm publish` directly._ Once published, add [release notes](https://github.com/graphql/graphql-js/tags). Use [semver](https://semver.org/) to determine which version part to increment. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index a98cba9c25..d82363189e 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -10,7 +10,7 @@ Please do not post general questions directly as GitHub issues. They may sit for Before filing a new issue, make sure an issue for your problem doesn't already exist. -The best way to get a bug fixed is to provide a *pull request* with a simplified failing test case (or better yet, include a fix). +The best way to get a bug fixed is to provide a _pull request_ with a simplified failing test case (or better yet, include a fix). # Feature requests diff --git a/.nycflowrc.yml b/.nycflowrc.yml index ad201c4f31..4032fdd014 100644 --- a/.nycflowrc.yml +++ b/.nycflowrc.yml @@ -1,10 +1,10 @@ include: - - "src/" + - 'src/' exclude: - - "src/polyfills" + - 'src/polyfills' clean: true -temp-directory: "coverage/flow" -report-dir: "coverage/flow" +temp-directory: 'coverage/flow' +report-dir: 'coverage/flow' skip-full: true skip-empty: true reporter: [json, html, text] diff --git a/.nycrc.yml b/.nycrc.yml index c15e75fa60..f6ead2c2e3 100644 --- a/.nycrc.yml +++ b/.nycrc.yml @@ -1,9 +1,9 @@ include: - - "src/" + - 'src/' exclude: - - "src/polyfills" + - 'src/polyfills' clean: true -temp-directory: "coverage/tests" -report-dir: "coverage/tests" +temp-directory: 'coverage/tests' +report-dir: 'coverage/tests' skip-full: true reporter: [json, html, text] diff --git a/.travis.yml b/.travis.yml index 4c7d2a5a74..d0de783f5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ cache: yarn # https://github.com/nodejs/Release node_js: -- '12' -- '10' -- '8' -- '6' + - '12' + - '10' + - '8' + - '6' script: | if [[ "$(node -pe process.version)" == v10.* ]]; then # Is latest LTS? @@ -20,11 +20,11 @@ script: | jobs: include: - - stage: deploy - if: type = push AND branch = master - script: npm run gitpublish - skip_cleanup: true - node_js: '10' + - stage: deploy + if: type = push AND branch = master + script: npm run gitpublish + skip_cleanup: true + node_js: '10' notifications: irc: @@ -33,7 +33,7 @@ notifications: on_failure: change skip_join: true channels: - - chat.freenode.net#graphql + - chat.freenode.net#graphql slack: secure: G7fzaXoPI1cyyW7dlpQ8oG/ot73n4kE83HgbyK1iEN1YBfodsytVgh0jS+zB3DhhRAotS/VfGVz9Wj2Oo109U5w/FyxdMGuKvFan/0B/aAws1sPxLGWA5230u1wTKQCHAu17+yppFOODUu1ILDXaD2A//Wj5iru9M4NnKc1bO6VHkfBHPTLQLbdPHmorwuSH02Ocbh7K4XOWzXRxM6VrwamEn1KnyXGu2w3QdJUT31OjGEEdf6FUzvjwzFgXPhngCw5+enpwm71ljHDNu8YHhXvHtS4328O5pYQO8np7j653HNEqi+ZUiYEOWpwC8be1xHdvi/s32tPFZiCx28ZmDoCUrY744tpPtE6tzuncmSKB0Y3EjutdXBpxllNr5l5hpX5092G2MlpokFbv85J+E2ALcZYNYeFOqTYTKwTYkxK6B1x4amBNpM+FXgUhloK4BK9OT0Qh5SiQOsM8cZT0h6QP91n+REljtpugW3VbuIxq5OJAi42FYbHBC27pohhq6ohU1euZfobk9a7ZawnjoEUk1EZHXiJzYKY/QqzyB6dwk0ersBl3l3OX/wnjwKTkqc9aTmDWo2L+lHaUCXuCY1+KQXsRicfnH395szTJXQbvcbN0zz188gdz6sawzi5BxndWo0NRwZyOG2YcyUHFQR4bK1rL7Lo6t6rijQ/XMeQ= diff --git a/README.md b/README.md index e682214701..66f1a8af5c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ https://graphql.org/graphql-js/. Looking for help? Find resources [from the community](https://graphql.org/community/). - ## Getting Started An overview of GraphQL in general is available in the @@ -47,7 +46,7 @@ import { graphql, GraphQLSchema, GraphQLObjectType, - GraphQLString + GraphQLString, } from 'graphql'; var schema = new GraphQLSchema({ @@ -58,10 +57,10 @@ var schema = new GraphQLSchema({ type: GraphQLString, resolve() { return 'world'; - } - } - } - }) + }, + }, + }, + }), }); ``` @@ -76,13 +75,11 @@ Then, serve the result of a query against that type schema. var query = '{ hello }'; graphql(schema, query).then(result => { - // Prints // { // data: { hello: "world" } // } console.log(result); - }); ``` @@ -94,7 +91,6 @@ it, reporting errors otherwise. var query = '{ boyhowdy }'; graphql(schema, query).then(result => { - // Prints // { // errors: [ @@ -103,7 +99,6 @@ graphql(schema, query).then(result => { // ] // } console.log(result); - }); ``` diff --git a/docs/APIReference-GraphQL.md b/docs/APIReference-GraphQL.md index 3db7cdf841..3aea9e87ba 100644 --- a/docs/APIReference-GraphQL.md +++ b/docs/APIReference-GraphQL.md @@ -17,7 +17,7 @@ var { graphql } = require('graphql'); // CommonJS ## Overview -*Entry Point* +_Entry Point_ -*Schema* +_Schema_ -*Type Definitions* +_Type Definitions_ -*Scalars* +_Scalars_ -*Errors* +_Errors_