From a1b3c73fb932bd00217882f82f47e36f3a320d3c Mon Sep 17 00:00:00 2001 From: Mayank Agarwal Date: Sat, 13 May 2017 12:18:56 +0530 Subject: [PATCH] chore: use eslint-plugin-playlyfe and upgrade all packages --- .eslintrc.js | 37 +- .flowconfig | 2 +- .vscode/settings.json | 18 + flow-typed/npm/apollo-codegen_vx.x.x.js | 4 +- flow-typed/npm/babel-cli_vx.x.x.js | 4 +- flow-typed/npm/babel-jest_vx.x.x.js | 4 +- .../npm/babel-plugin-flow-runtime_vx.x.x.js | 4 +- flow-typed/npm/babel-polyfill_vx.x.x.js | 4 +- .../npm/babel-preset-playlyfe_vx.x.x.js | 4 +- flow-typed/npm/babel-runtime_vx.x.x.js | 4 +- flow-typed/npm/codecov_vx.x.x.js | 18 +- flow-typed/npm/commitizen_vx.x.x.js | 4 +- flow-typed/npm/cross-env_vx.x.x.js | 11 +- .../npm/cz-conventional-changelog_vx.x.x.js | 4 +- flow-typed/npm/dentist_vx.x.x.js | 4 +- .../npm/eslint-plugin-playlyfe_vx.x.x.js | 263 ++++++++++ flow-typed/npm/eslint_vx.x.x.js | 4 +- flow-typed/npm/fb-watchman_vx.x.x.js | 4 +- flow-typed/npm/find-config_vx.x.x.js | 4 +- flow-typed/npm/flow-runtime_vx.x.x.js | 4 +- flow-typed/npm/flow-typed_vx.x.x.js | 4 +- flow-typed/npm/husky_vx.x.x.js | 4 +- flow-typed/npm/jest_v20.x.x.js | 471 ++++++++++++++++++ flow-typed/npm/jest_vx.x.x.js | 4 +- flow-typed/npm/json5_vx.x.x.js | 4 +- flow-typed/npm/keymirror_vx.x.x.js | 4 +- flow-typed/npm/memory-fs_vx.x.x.js | 4 +- flow-typed/npm/minimatch_vx.x.x.js | 4 +- flow-typed/npm/node-ipc_vx.x.x.js | 4 +- flow-typed/npm/parse-glob_vx.x.x.js | 4 +- flow-typed/npm/promise-retry_vx.x.x.js | 4 +- flow-typed/npm/semantic-release_vx.x.x.js | 4 +- package.json | 17 +- src/GQLService.js | 2 +- src/__test-data__/utils.js | 16 +- src/__tests__/GQLService_findRefs.test.js | 2 +- src/__tests__/GQLService_getDef.test.js | 4 +- src/__tests__/GQLService_getInfo.test.js | 4 +- src/cli/rpc/Client.js | 2 +- src/cli/rpc/Server.js | 2 +- src/config/GQLConfig.js | 4 +- src/config/__tests__/GQLConfig.test.js | 4 +- src/index.js | 2 +- src/query/QueryManager.js | 49 +- src/query/_shared/Parsers/QueryParser.js | 4 +- src/query/_shared/getTypeInfo.js | 61 ++- src/query/_shared/parseQuery.js | 2 +- src/query/commands/getHintsAtPosition.js | 32 +- .../commands/getInfoOfTokenAtPosition.js | 33 +- .../validation/rules/_shared/replaceRules.js | 2 +- .../gql-rules-query-relay/ScalarLeafs.js | 8 +- src/query/validation/validate.js | 2 +- src/schema/SchemaBuilder/GQLSchema.js | 22 +- src/schema/SchemaBuilder/GQLSchemaBuilder.js | 47 +- src/schema/SchemaBuilder/PlaceholderTypes.js | 17 +- src/schema/SchemaBuilder/buildASTSchema.js | 225 +++++---- src/schema/_shared/SchemaParser.js | 2 +- .../commands/findRefsOfTokenAtPosition.js | 20 +- .../commands/getDefinitionAtPosition.js | 11 +- src/schema/commands/getHintsAtPosition.js | 52 +- .../commands/getInfoOfTokenAtPosition.js | 11 +- src/shared/GQLError.js | 6 +- src/shared/GQLTypes.js | 65 ++- src/shared/MultilineCharacterStream.js | 16 +- src/shared/__mocks__/watch.js | 4 +- src/shared/createValidate.js | 4 +- src/shared/debug.js | 2 +- src/shared/getTokenAtPosition.js | 2 +- src/shared/suggestionList.js | 22 - src/shared/types.js | 4 +- src/shared/watch.js | 108 ++-- src/tools/__tests__/generate.test.js | 4 + src/tools/generate/index.js | 2 +- yarn.lock | 376 +++++++------- 74 files changed, 1503 insertions(+), 691 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 flow-typed/npm/eslint-plugin-playlyfe_vx.x.x.js create mode 100644 flow-typed/npm/jest_v20.x.x.js delete mode 100755 src/shared/suggestionList.js diff --git a/.eslintrc.js b/.eslintrc.js index d1dcad0..0d727d8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,33 +1,16 @@ /* @flow */ module.exports = { - extends: [ - 'eslint-config-airbnb-base/rules/best-practices', - 'eslint-config-airbnb-base/rules/errors', - 'eslint-config-airbnb-base/rules/node', - 'eslint-config-airbnb-base/rules/style', - 'eslint-config-airbnb-base/rules/variables', - 'eslint-config-airbnb-base/rules/es6', - ].map(require.resolve), - - parser: require.resolve('babel-eslint'), - - globals: { - describe: false, - beforeEach: false, - jest: false, - it: false, - expect: false, - test: false, + plugins: [ + "playlyfe", + ], - // flow - $Exact: false, - $Keys: false, - }, + extends: [ + "plugin:playlyfe/js", + "plugin:playlyfe/flow", + "plugin:playlyfe/testing:jest", + ], - rules: { - 'no-param-reassign': ['error', { 'props': false }], - 'no-underscore-dangle': 'off', - 'global-require': 'off', - 'arrow-parens': 'off', + env: { + node: true, }, }; diff --git a/.flowconfig b/.flowconfig index 66f7f4f..218e36e 100755 --- a/.flowconfig +++ b/.flowconfig @@ -15,4 +15,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue suppress_comment=\\(.\\|\n\\)*\\$FlowDisableNextLine [version] -^0.45.0 +^0.46.0 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2373c82 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,18 @@ +// Place your settings in this file to overwrite default and user settings. +{ + "search.exclude": { + "**/node_modules": true, + "lib/**": true + }, + + "prettier.eslintIntegration": true, + "prettier.bracketSpacing": true, + "prettier.semi": true, + "prettier.parser": "flow", + "prettier.tabWidth": 2, + "prettier.singleQuote": true, + "prettier.jsxBracketSameLine": false, + "prettier.printWidth": 80, + "prettier.trailingComma": "all", + "prettier.useTabs": false +} diff --git a/flow-typed/npm/apollo-codegen_vx.x.x.js b/flow-typed/npm/apollo-codegen_vx.x.x.js index 8e8a8ca..aa59b39 100644 --- a/flow-typed/npm/apollo-codegen_vx.x.x.js +++ b/flow-typed/npm/apollo-codegen_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: cfa0d8893229c95fd887ed3b5c6af094 -// flow-typed version: <>/apollo-codegen_v0.10.13/flow_v0.45.0 +// flow-typed signature: b6f73c0c3859c2e1f264b0d51606058c +// flow-typed version: <>/apollo-codegen_v0.10.13/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/babel-cli_vx.x.x.js b/flow-typed/npm/babel-cli_vx.x.x.js index 7d066b9..90a7de2 100644 --- a/flow-typed/npm/babel-cli_vx.x.x.js +++ b/flow-typed/npm/babel-cli_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 62d5a342fa15ea201e409973136ddcb4 -// flow-typed version: <>/babel-cli_v6.24.1/flow_v0.45.0 +// flow-typed signature: bef8cad2bb32428fdb45a8c60c66782c +// flow-typed version: <>/babel-cli_v6.24.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/babel-jest_vx.x.x.js b/flow-typed/npm/babel-jest_vx.x.x.js index 128d55f..0d83ccb 100644 --- a/flow-typed/npm/babel-jest_vx.x.x.js +++ b/flow-typed/npm/babel-jest_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: d4d4654ad3732220fd3ecfe85e58a0b4 -// flow-typed version: <>/babel-jest_v20.0.0/flow_v0.45.0 +// flow-typed signature: e116367f1052e4367e3c1026974705e2 +// flow-typed version: <>/babel-jest_v20.0.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/babel-plugin-flow-runtime_vx.x.x.js b/flow-typed/npm/babel-plugin-flow-runtime_vx.x.x.js index 720145f..4268317 100644 --- a/flow-typed/npm/babel-plugin-flow-runtime_vx.x.x.js +++ b/flow-typed/npm/babel-plugin-flow-runtime_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 6ffda7700a1b394304c135bdd9145fe5 -// flow-typed version: <>/babel-plugin-flow-runtime_v0.11.1/flow_v0.45.0 +// flow-typed signature: dc60d7f07e7fb0f6458351084a2083fc +// flow-typed version: <>/babel-plugin-flow-runtime_v0.11.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/babel-polyfill_vx.x.x.js b/flow-typed/npm/babel-polyfill_vx.x.x.js index d89da30..24ce058 100644 --- a/flow-typed/npm/babel-polyfill_vx.x.x.js +++ b/flow-typed/npm/babel-polyfill_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 0800d1ccddf24e17e857307bd563b4b0 -// flow-typed version: <>/babel-polyfill_v6.23.0/flow_v0.45.0 +// flow-typed signature: e022b191a48f2fd6a8d4cdfbe18da486 +// flow-typed version: <>/babel-polyfill_v6.23.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/babel-preset-playlyfe_vx.x.x.js b/flow-typed/npm/babel-preset-playlyfe_vx.x.x.js index b89eae3..faabdb8 100644 --- a/flow-typed/npm/babel-preset-playlyfe_vx.x.x.js +++ b/flow-typed/npm/babel-preset-playlyfe_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: b5c1486632979e60a5cddfa948228a69 -// flow-typed version: <>/babel-preset-playlyfe_v1.2.0/flow_v0.45.0 +// flow-typed signature: 48042622b76a327793ec9e6cea24665e +// flow-typed version: <>/babel-preset-playlyfe_v1.2.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/babel-runtime_vx.x.x.js b/flow-typed/npm/babel-runtime_vx.x.x.js index 99cc9d0..9e0e9bf 100644 --- a/flow-typed/npm/babel-runtime_vx.x.x.js +++ b/flow-typed/npm/babel-runtime_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 56d474d75123da9c54dfdd10fbb8d95b -// flow-typed version: <>/babel-runtime_v6.23.0/flow_v0.45.0 +// flow-typed signature: 7442be28083a77ed74071b25662c3c9c +// flow-typed version: <>/babel-runtime_v6.23.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/codecov_vx.x.x.js b/flow-typed/npm/codecov_vx.x.x.js index 6a3c622..ad263ff 100644 --- a/flow-typed/npm/codecov_vx.x.x.js +++ b/flow-typed/npm/codecov_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 559c5dc6ac0cf2bdbc482c36e48b44ff -// flow-typed version: <>/codecov_v2.1.0/flow_v0.45.0 +// flow-typed signature: 6fc611692e0632777ba4b3f4cad5e280 +// flow-typed version: <>/codecov_v2.2.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: @@ -30,6 +30,10 @@ declare module 'codecov/lib/detect' { declare module.exports: any; } +declare module 'codecov/lib/git' { + declare module.exports: any; +} + declare module 'codecov/lib/offline' { declare module.exports: any; } @@ -90,6 +94,10 @@ declare module 'codecov/test/detect' { declare module.exports: any; } +declare module 'codecov/test/git' { + declare module.exports: any; +} + declare module 'codecov/test/index' { declare module.exports: any; } @@ -167,6 +175,9 @@ declare module 'codecov/lib/codecov.js' { declare module 'codecov/lib/detect.js' { declare module.exports: $Exports<'codecov/lib/detect'>; } +declare module 'codecov/lib/git.js' { + declare module.exports: $Exports<'codecov/lib/git'>; +} declare module 'codecov/lib/offline.js' { declare module.exports: $Exports<'codecov/lib/offline'>; } @@ -212,6 +223,9 @@ declare module 'codecov/lib/services/wercker.js' { declare module 'codecov/test/detect.js' { declare module.exports: $Exports<'codecov/test/detect'>; } +declare module 'codecov/test/git.js' { + declare module.exports: $Exports<'codecov/test/git'>; +} declare module 'codecov/test/index.js' { declare module.exports: $Exports<'codecov/test/index'>; } diff --git a/flow-typed/npm/commitizen_vx.x.x.js b/flow-typed/npm/commitizen_vx.x.x.js index 51da723..c86ff5c 100644 --- a/flow-typed/npm/commitizen_vx.x.x.js +++ b/flow-typed/npm/commitizen_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 8cc47cfb416b05322bf93b28eb231e03 -// flow-typed version: <>/commitizen_v2.9.6/flow_v0.45.0 +// flow-typed signature: 0b2a83fc9a96bc29594c0d5628585d1c +// flow-typed version: <>/commitizen_v2.9.6/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/cross-env_vx.x.x.js b/flow-typed/npm/cross-env_vx.x.x.js index 90b65cc..1b80bc5 100644 --- a/flow-typed/npm/cross-env_vx.x.x.js +++ b/flow-typed/npm/cross-env_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 8fd5d17da1c49627f1d3edce176a3803 -// flow-typed version: <>/cross-env_v4.0.0/flow_v0.45.0 +// flow-typed signature: a1cfec0fa34518a3533d8aa65cbb0113 +// flow-typed version: <>/cross-env_v5.0.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: @@ -22,6 +22,10 @@ declare module 'cross-env' { * require those files directly. Feel free to delete any files that aren't * needed. */ +declare module 'cross-env/dist/bin/cross-env-shell' { + declare module.exports: any; +} + declare module 'cross-env/dist/bin/cross-env' { declare module.exports: any; } @@ -39,6 +43,9 @@ declare module 'cross-env/dist/variable' { } // Filename aliases +declare module 'cross-env/dist/bin/cross-env-shell.js' { + declare module.exports: $Exports<'cross-env/dist/bin/cross-env-shell'>; +} declare module 'cross-env/dist/bin/cross-env.js' { declare module.exports: $Exports<'cross-env/dist/bin/cross-env'>; } diff --git a/flow-typed/npm/cz-conventional-changelog_vx.x.x.js b/flow-typed/npm/cz-conventional-changelog_vx.x.x.js index 863fdb5..a59d204 100644 --- a/flow-typed/npm/cz-conventional-changelog_vx.x.x.js +++ b/flow-typed/npm/cz-conventional-changelog_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: dadc6bbcba876d4e4b6ecf630d10923a -// flow-typed version: <>/cz-conventional-changelog_v2.0.0/flow_v0.45.0 +// flow-typed signature: 01effcfca0e631b0a9f79497615fa7e4 +// flow-typed version: <>/cz-conventional-changelog_v2.0.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/dentist_vx.x.x.js b/flow-typed/npm/dentist_vx.x.x.js index 49b40a1..c7abd3a 100644 --- a/flow-typed/npm/dentist_vx.x.x.js +++ b/flow-typed/npm/dentist_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: ecca4dece5de02b6f637965a7e8637c2 -// flow-typed version: <>/dentist_v1.0.3/flow_v0.45.0 +// flow-typed signature: a6d887c2da6f81d300d7163501bdefdd +// flow-typed version: <>/dentist_v1.0.3/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/eslint-plugin-playlyfe_vx.x.x.js b/flow-typed/npm/eslint-plugin-playlyfe_vx.x.x.js new file mode 100644 index 0000000..5113ff6 --- /dev/null +++ b/flow-typed/npm/eslint-plugin-playlyfe_vx.x.x.js @@ -0,0 +1,263 @@ +// flow-typed signature: f3f08e681612a7d2d297cd07d74db39c +// flow-typed version: <>/eslint-plugin-playlyfe_v3.0.0/flow_v0.46.0 + +/** + * This is an autogenerated libdef stub for: + * + * 'eslint-plugin-playlyfe' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'eslint-plugin-playlyfe' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'eslint-plugin-playlyfe/lib/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/flow/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/best-practices' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/es-latest' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/imports' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/node-commonjs' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/possible-errors' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/strict-mode' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/stylistic-issues' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/variables' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/rules/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/js/rules/use-exact-dependency' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-empty-translation' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-missing-id' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-undef-id' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-untranslated-string' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/utils/isLocaleFile' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react/configs' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react/rules/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react/rules/react-jsx-pascal-case-patched' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/react/rules/react-style-no-numeric-string-value' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/relay/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/relay/rules/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/relay/rules/relay-no-missing-variable-in-props' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/plugins/testing/index' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/processors/json' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/utils/renameRules' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/utils/RuleTester' { + declare module.exports: any; +} + +declare module 'eslint-plugin-playlyfe/lib/utils/runRule' { + declare module.exports: any; +} + +// Filename aliases +declare module 'eslint-plugin-playlyfe/lib/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/flow/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/flow/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/best-practices.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/best-practices'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/es-latest.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/es-latest'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/imports.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/imports'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/node-commonjs.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/node-commonjs'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/possible-errors.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/possible-errors'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/strict-mode.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/strict-mode'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/stylistic-issues.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/stylistic-issues'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/configs/variables.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/configs/variables'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/rules/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/rules/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/js/rules/use-exact-dependency.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/js/rules/use-exact-dependency'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react-intl/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-empty-translation.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-empty-translation'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-missing-id.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-missing-id'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-undef-id.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-undef-id'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-untranslated-string.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/react-intl-no-untranslated-string'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/utils/isLocaleFile.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react-intl/rules/utils/isLocaleFile'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react/configs.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react/configs'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react/rules/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react/rules/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react/rules/react-jsx-pascal-case-patched.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react/rules/react-jsx-pascal-case-patched'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/react/rules/react-style-no-numeric-string-value.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/react/rules/react-style-no-numeric-string-value'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/relay/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/relay/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/relay/rules/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/relay/rules/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/relay/rules/relay-no-missing-variable-in-props.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/relay/rules/relay-no-missing-variable-in-props'>; +} +declare module 'eslint-plugin-playlyfe/lib/plugins/testing/index.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/plugins/testing/index'>; +} +declare module 'eslint-plugin-playlyfe/lib/processors/json.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/processors/json'>; +} +declare module 'eslint-plugin-playlyfe/lib/utils/renameRules.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/utils/renameRules'>; +} +declare module 'eslint-plugin-playlyfe/lib/utils/RuleTester.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/utils/RuleTester'>; +} +declare module 'eslint-plugin-playlyfe/lib/utils/runRule.js' { + declare module.exports: $Exports<'eslint-plugin-playlyfe/lib/utils/runRule'>; +} diff --git a/flow-typed/npm/eslint_vx.x.x.js b/flow-typed/npm/eslint_vx.x.x.js index 3c1892d..67ee9bd 100644 --- a/flow-typed/npm/eslint_vx.x.x.js +++ b/flow-typed/npm/eslint_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 47f7321ca2214fb5a20d0bc3150b7ed6 -// flow-typed version: <>/eslint_v3.19.0/flow_v0.45.0 +// flow-typed signature: 34e61917f309fb658542988a913e40e6 +// flow-typed version: <>/eslint_v3.19.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/fb-watchman_vx.x.x.js b/flow-typed/npm/fb-watchman_vx.x.x.js index a8de93e..d75d470 100644 --- a/flow-typed/npm/fb-watchman_vx.x.x.js +++ b/flow-typed/npm/fb-watchman_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 56bc4af3c8b09213aca4d1f2dabef5af -// flow-typed version: <>/fb-watchman_v2.0.0/flow_v0.45.0 +// flow-typed signature: fefe3e7176829d5610e325a684f937bb +// flow-typed version: <>/fb-watchman_v2.0.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/find-config_vx.x.x.js b/flow-typed/npm/find-config_vx.x.x.js index 13b83b0..0bbae6c 100644 --- a/flow-typed/npm/find-config_vx.x.x.js +++ b/flow-typed/npm/find-config_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: c6e360c87e3f6634c7aad1707919020c -// flow-typed version: <>/find-config_v1.0.0/flow_v0.45.0 +// flow-typed signature: 7c97fdd26b694bd3de77d0bd0a7bdf64 +// flow-typed version: <>/find-config_v1.0.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/flow-runtime_vx.x.x.js b/flow-typed/npm/flow-runtime_vx.x.x.js index 8d508de..1968978 100644 --- a/flow-typed/npm/flow-runtime_vx.x.x.js +++ b/flow-typed/npm/flow-runtime_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 99b1204e668fd2ef549a9f41dc0ea2ae -// flow-typed version: <>/flow-runtime_v0.12.0/flow_v0.45.0 +// flow-typed signature: 0e63c54a630d7bfd59a6e639f61b969d +// flow-typed version: <>/flow-runtime_v0.12.0/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/flow-typed_vx.x.x.js b/flow-typed/npm/flow-typed_vx.x.x.js index f5b2d47..f7515d2 100644 --- a/flow-typed/npm/flow-typed_vx.x.x.js +++ b/flow-typed/npm/flow-typed_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 2bd44279672e2c6e1d4ca6f6511abb37 -// flow-typed version: <>/flow-typed_v2.1.2/flow_v0.45.0 +// flow-typed signature: fe6193cea8c2348ac82d1b4c1b91f8d7 +// flow-typed version: <>/flow-typed_v2.1.2/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/husky_vx.x.x.js b/flow-typed/npm/husky_vx.x.x.js index b52d184..443a324 100644 --- a/flow-typed/npm/husky_vx.x.x.js +++ b/flow-typed/npm/husky_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: cebde4efbccd894a15641d8734741ae5 -// flow-typed version: <>/husky_v0.13.3/flow_v0.45.0 +// flow-typed signature: d6c097076a48bb72ee0ffcc70c1599f3 +// flow-typed version: <>/husky_v0.13.3/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/jest_v20.x.x.js b/flow-typed/npm/jest_v20.x.x.js new file mode 100644 index 0000000..9787497 --- /dev/null +++ b/flow-typed/npm/jest_v20.x.x.js @@ -0,0 +1,471 @@ +// flow-typed signature: 2b0e172fa5655d6ae10387616943ccc3 +// flow-typed version: 4539f4f195/jest_v20.x.x/flow_>=v0.33.x + +type JestMockFn = { + (...args: Array): any, + /** + * An object for introspecting mock calls + */ + mock: { + /** + * An array that represents all calls that have been made into this mock + * function. Each call is represented by an array of arguments that were + * passed during the call. + */ + calls: Array>, + /** + * An array that contains all the object instances that have been + * instantiated from this mock function. + */ + instances: mixed + }, + /** + * Resets all information stored in the mockFn.mock.calls and + * mockFn.mock.instances arrays. Often this is useful when you want to clean + * up a mock's usage data between two assertions. + */ + mockClear(): Function, + /** + * Resets all information stored in the mock. This is useful when you want to + * completely restore a mock back to its initial state. + */ + mockReset(): Function, + /** + * Accepts a function that should be used as the implementation of the mock. + * The mock itself will still record all calls that go into and instances + * that come from itself -- the only difference is that the implementation + * will also be executed when the mock is called. + */ + mockImplementation(fn: Function): JestMockFn, + /** + * Accepts a function that will be used as an implementation of the mock for + * one call to the mocked function. Can be chained so that multiple function + * calls produce different results. + */ + mockImplementationOnce(fn: Function): JestMockFn, + /** + * Just a simple sugar function for returning `this` + */ + mockReturnThis(): void, + /** + * Deprecated: use jest.fn(() => value) instead + */ + mockReturnValue(value: any): JestMockFn, + /** + * Sugar for only returning a value once inside your mock + */ + mockReturnValueOnce(value: any): JestMockFn +}; + +type JestAsymmetricEqualityType = { + /** + * A custom Jasmine equality tester + */ + asymmetricMatch(value: mixed): boolean +}; + +type JestCallsType = { + allArgs(): mixed, + all(): mixed, + any(): boolean, + count(): number, + first(): mixed, + mostRecent(): mixed, + reset(): void +}; + +type JestClockType = { + install(): void, + mockDate(date: Date): void, + tick(): void, + uninstall(): void +}; + +type JestMatcherResult = { + message?: string | (() => string), + pass: boolean +}; + +type JestMatcher = (actual: any, expected: any) => JestMatcherResult; + +type JestPromiseType = { + /** + * Use rejects to unwrap the reason of a rejected promise so any other + * matcher can be chained. If the promise is fulfilled the assertion fails. + */ + rejects(): JestExpectType, + /** + * Use resolves to unwrap the value of a fulfilled promise so any other + * matcher can be chained. If the promise is rejected the assertion fails. + */ + resolves(): JestExpectType +}; + +type JestExpectType = { + not: JestExpectType, + /** + * If you have a mock function, you can use .lastCalledWith to test what + * arguments it was last called with. + */ + lastCalledWith(...args: Array): void, + /** + * toBe just checks that a value is what you expect. It uses === to check + * strict equality. + */ + toBe(value: any): void, + /** + * Use .toHaveBeenCalled to ensure that a mock function got called. + */ + toBeCalled(): void, + /** + * Use .toBeCalledWith to ensure that a mock function was called with + * specific arguments. + */ + toBeCalledWith(...args: Array): void, + /** + * Using exact equality with floating point numbers is a bad idea. Rounding + * means that intuitive things fail. + */ + toBeCloseTo(num: number, delta: any): void, + /** + * Use .toBeDefined to check that a variable is not undefined. + */ + toBeDefined(): void, + /** + * Use .toBeFalsy when you don't care what a value is, you just want to + * ensure a value is false in a boolean context. + */ + toBeFalsy(): void, + /** + * To compare floating point numbers, you can use toBeGreaterThan. + */ + toBeGreaterThan(number: number): void, + /** + * To compare floating point numbers, you can use toBeGreaterThanOrEqual. + */ + toBeGreaterThanOrEqual(number: number): void, + /** + * To compare floating point numbers, you can use toBeLessThan. + */ + toBeLessThan(number: number): void, + /** + * To compare floating point numbers, you can use toBeLessThanOrEqual. + */ + toBeLessThanOrEqual(number: number): void, + /** + * Use .toBeInstanceOf(Class) to check that an object is an instance of a + * class. + */ + toBeInstanceOf(cls: Class<*>): void, + /** + * .toBeNull() is the same as .toBe(null) but the error messages are a bit + * nicer. + */ + toBeNull(): void, + /** + * Use .toBeTruthy when you don't care what a value is, you just want to + * ensure a value is true in a boolean context. + */ + toBeTruthy(): void, + /** + * Use .toBeUndefined to check that a variable is undefined. + */ + toBeUndefined(): void, + /** + * Use .toContain when you want to check that an item is in a list. For + * testing the items in the list, this uses ===, a strict equality check. + */ + toContain(item: any): void, + /** + * Use .toContainEqual when you want to check that an item is in a list. For + * testing the items in the list, this matcher recursively checks the + * equality of all fields, rather than checking for object identity. + */ + toContainEqual(item: any): void, + /** + * Use .toEqual when you want to check that two objects have the same value. + * This matcher recursively checks the equality of all fields, rather than + * checking for object identity. + */ + toEqual(value: any): void, + /** + * Use .toHaveBeenCalled to ensure that a mock function got called. + */ + toHaveBeenCalled(): void, + /** + * Use .toHaveBeenCalledTimes to ensure that a mock function got called exact + * number of times. + */ + toHaveBeenCalledTimes(number: number): void, + /** + * Use .toHaveBeenCalledWith to ensure that a mock function was called with + * specific arguments. + */ + toHaveBeenCalledWith(...args: Array): void, + /** + * Check that an object has a .length property and it is set to a certain + * numeric value. + */ + toHaveLength(number: number): void, + /** + * + */ + toHaveProperty(propPath: string, value?: any): void, + /** + * Use .toMatch to check that a string matches a regular expression. + */ + toMatch(regexp: RegExp): void, + /** + * Use .toMatchObject to check that a javascript object matches a subset of the properties of an object. + */ + toMatchObject(object: Object): void, + /** + * This ensures that a React component matches the most recent snapshot. + */ + toMatchSnapshot(name?: string): void, + /** + * Use .toThrow to test that a function throws when it is called. + */ + toThrow(message?: string | Error): void, + /** + * Use .toThrowError to test that a function throws a specific error when it + * is called. The argument can be a string for the error message, a class for + * the error, or a regex that should match the error. + */ + toThrowError(message?: string | Error | RegExp): void, + /** + * Use .toThrowErrorMatchingSnapshot to test that a function throws a error + * matching the most recent snapshot when it is called. + */ + toThrowErrorMatchingSnapshot(): void +}; + +type JestObjectType = { + /** + * Disables automatic mocking in the module loader. + * + * After this method is called, all `require()`s will return the real + * versions of each module (rather than a mocked version). + */ + disableAutomock(): JestObjectType, + /** + * An un-hoisted version of disableAutomock + */ + autoMockOff(): JestObjectType, + /** + * Enables automatic mocking in the module loader. + */ + enableAutomock(): JestObjectType, + /** + * An un-hoisted version of enableAutomock + */ + autoMockOn(): JestObjectType, + /** + * Clears the mock.calls and mock.instances properties of all mocks. + * Equivalent to calling .mockClear() on every mocked function. + */ + clearAllMocks(): JestObjectType, + /** + * Resets the state of all mocks. Equivalent to calling .mockReset() on every + * mocked function. + */ + resetAllMocks(): JestObjectType, + /** + * Removes any pending timers from the timer system. + */ + clearAllTimers(): void, + /** + * The same as `mock` but not moved to the top of the expectation by + * babel-jest. + */ + doMock(moduleName: string, moduleFactory?: any): JestObjectType, + /** + * The same as `unmock` but not moved to the top of the expectation by + * babel-jest. + */ + dontMock(moduleName: string): JestObjectType, + /** + * Returns a new, unused mock function. Optionally takes a mock + * implementation. + */ + fn(implementation?: Function): JestMockFn, + /** + * Determines if the given function is a mocked function. + */ + isMockFunction(fn: Function): boolean, + /** + * Given the name of a module, use the automatic mocking system to generate a + * mocked version of the module for you. + */ + genMockFromModule(moduleName: string): any, + /** + * Mocks a module with an auto-mocked version when it is being required. + * + * The second argument can be used to specify an explicit module factory that + * is being run instead of using Jest's automocking feature. + * + * The third argument can be used to create virtual mocks -- mocks of modules + * that don't exist anywhere in the system. + */ + mock(moduleName: string, moduleFactory?: any): JestObjectType, + /** + * Resets the module registry - the cache of all required modules. This is + * useful to isolate modules where local state might conflict between tests. + */ + resetModules(): JestObjectType, + /** + * Exhausts the micro-task queue (usually interfaced in node via + * process.nextTick). + */ + runAllTicks(): void, + /** + * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(), + * setInterval(), and setImmediate()). + */ + runAllTimers(): void, + /** + * Exhausts all tasks queued by setImmediate(). + */ + runAllImmediates(): void, + /** + * Executes only the macro task queue (i.e. all tasks queued by setTimeout() + * or setInterval() and setImmediate()). + */ + runTimersToTime(msToRun: number): void, + /** + * Executes only the macro-tasks that are currently pending (i.e., only the + * tasks that have been queued by setTimeout() or setInterval() up to this + * point) + */ + runOnlyPendingTimers(): void, + /** + * Explicitly supplies the mock object that the module system should return + * for the specified module. Note: It is recommended to use jest.mock() + * instead. + */ + setMock(moduleName: string, moduleExports: any): JestObjectType, + /** + * Indicates that the module system should never return a mocked version of + * the specified module from require() (e.g. that it should always return the + * real module). + */ + unmock(moduleName: string): JestObjectType, + /** + * Instructs Jest to use fake versions of the standard timer functions + * (setTimeout, setInterval, clearTimeout, clearInterval, nextTick, + * setImmediate and clearImmediate). + */ + useFakeTimers(): JestObjectType, + /** + * Instructs Jest to use the real versions of the standard timer functions. + */ + useRealTimers(): JestObjectType, + /** + * Creates a mock function similar to jest.fn but also tracks calls to + * object[methodName]. + */ + spyOn(object: Object, methodName: string): JestMockFn +}; + +type JestSpyType = { + calls: JestCallsType +}; + +/** Runs this function after every test inside this context */ +declare function afterEach(fn: Function): void; +/** Runs this function before every test inside this context */ +declare function beforeEach(fn: Function): void; +/** Runs this function after all tests have finished inside this context */ +declare function afterAll(fn: Function): void; +/** Runs this function before any tests have started inside this context */ +declare function beforeAll(fn: Function): void; +/** A context for grouping tests together */ +declare function describe(name: string, fn: Function): void; + +/** An individual test unit */ +declare var it: { + /** + * An individual test unit + * + * @param {string} Name of Test + * @param {Function} Test + */ + (name: string, fn?: Function): ?Promise, + /** + * Only run this test + * + * @param {string} Name of Test + * @param {Function} Test + */ + only(name: string, fn?: Function): ?Promise, + /** + * Skip running this test + * + * @param {string} Name of Test + * @param {Function} Test + */ + skip(name: string, fn?: Function): ?Promise, + /** + * Run the test concurrently + * + * @param {string} Name of Test + * @param {Function} Test + */ + concurrent(name: string, fn?: Function): ?Promise +}; +declare function fit(name: string, fn: Function): ?Promise; +/** An individual test unit */ +declare var test: typeof it; +/** A disabled group of tests */ +declare var xdescribe: typeof describe; +/** A focused group of tests */ +declare var fdescribe: typeof describe; +/** A disabled individual test */ +declare var xit: typeof it; +/** A disabled individual test */ +declare var xtest: typeof it; + +/** The expect function is used every time you want to test a value */ +declare var expect: { + /** The object that you want to make assertions against */ + (value: any): JestExpectType & JestPromiseType, + /** Add additional Jasmine matchers to Jest's roster */ + extend(matchers: { [name: string]: JestMatcher }): void, + /** Add a module that formats application-specific data structures. */ + addSnapshotSerializer(serializer: (input: Object) => string): void, + assertions(expectedAssertions: number): void, + hasAssertions(): void, + any(value: mixed): JestAsymmetricEqualityType, + anything(): void, + arrayContaining(value: Array): void, + objectContaining(value: Object): void, + /** Matches any received string that contains the exact expected string. */ + stringContaining(value: string): void, + stringMatching(value: string | RegExp): void +}; + +// TODO handle return type +// http://jasmine.github.io/2.4/introduction.html#section-Spies +declare function spyOn(value: mixed, method: string): Object; + +/** Holds all functions related to manipulating test runner */ +declare var jest: JestObjectType; + +/** + * The global Jamine object, this is generally not exposed as the public API, + * using features inside here could break in later versions of Jest. + */ +declare var jasmine: { + DEFAULT_TIMEOUT_INTERVAL: number, + any(value: mixed): JestAsymmetricEqualityType, + anything(): void, + arrayContaining(value: Array): void, + clock(): JestClockType, + createSpy(name: string): JestSpyType, + createSpyObj( + baseName: string, + methodNames: Array + ): { [methodName: string]: JestSpyType }, + objectContaining(value: Object): void, + stringMatching(value: string): void +}; diff --git a/flow-typed/npm/jest_vx.x.x.js b/flow-typed/npm/jest_vx.x.x.js index 788b328..23196ca 100644 --- a/flow-typed/npm/jest_vx.x.x.js +++ b/flow-typed/npm/jest_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 63f09a71e4e0d8797e3638a96dc5acfb -// flow-typed version: <>/jest_v20.0.0/flow_v0.45.0 +// flow-typed signature: 6a28e8c403ff9cb83d2f9193b8f1d910 +// flow-typed version: <>/jest_v20.0.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/json5_vx.x.x.js b/flow-typed/npm/json5_vx.x.x.js index 3a384fe..b7d1cb8 100644 --- a/flow-typed/npm/json5_vx.x.x.js +++ b/flow-typed/npm/json5_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: a69d8b692b3bbd6480cc78b7ed95f87a -// flow-typed version: <>/json5_v0.5.1/flow_v0.45.0 +// flow-typed signature: 2534a672ebee9f2f7c5562ff354169b3 +// flow-typed version: <>/json5_v0.5.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/keymirror_vx.x.x.js b/flow-typed/npm/keymirror_vx.x.x.js index f6dae79..d1ddba7 100644 --- a/flow-typed/npm/keymirror_vx.x.x.js +++ b/flow-typed/npm/keymirror_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 677bb9564b8e85349d8e59273e158436 -// flow-typed version: <>/keymirror_v0.1.1/flow_v0.45.0 +// flow-typed signature: e042d231e75f69bc1e34681e9534fc27 +// flow-typed version: <>/keymirror_v0.1.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/memory-fs_vx.x.x.js b/flow-typed/npm/memory-fs_vx.x.x.js index 7e11f3f..12afac0 100644 --- a/flow-typed/npm/memory-fs_vx.x.x.js +++ b/flow-typed/npm/memory-fs_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: e411a622da384032d2a73d7feeae1b24 -// flow-typed version: <>/memory-fs_v0.4.1/flow_v0.45.0 +// flow-typed signature: 88c39130038995ee1d169da9134f4831 +// flow-typed version: <>/memory-fs_v0.4.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/minimatch_vx.x.x.js b/flow-typed/npm/minimatch_vx.x.x.js index 64783a9..ed1b198 100644 --- a/flow-typed/npm/minimatch_vx.x.x.js +++ b/flow-typed/npm/minimatch_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 16efe89ffc2da74b55978f9ba8bd8ad5 -// flow-typed version: <>/minimatch_v3.0.4/flow_v0.45.0 +// flow-typed signature: b6fe4040cf868a8b0b5f32d9ae2e318d +// flow-typed version: <>/minimatch_v3.0.4/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/node-ipc_vx.x.x.js b/flow-typed/npm/node-ipc_vx.x.x.js index ac26ddf..02e9ab5 100644 --- a/flow-typed/npm/node-ipc_vx.x.x.js +++ b/flow-typed/npm/node-ipc_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 814acc9114f13f19ac3a2bd0f4dc1a94 -// flow-typed version: <>/node-ipc_v9.0.1/flow_v0.45.0 +// flow-typed signature: ad519941b638dfcb6cc23270b21158f1 +// flow-typed version: <>/node-ipc_v9.0.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/parse-glob_vx.x.x.js b/flow-typed/npm/parse-glob_vx.x.x.js index e42954e..45ed3bf 100644 --- a/flow-typed/npm/parse-glob_vx.x.x.js +++ b/flow-typed/npm/parse-glob_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 2b7c9a45a73b10fc8af88448d5e545c0 -// flow-typed version: <>/parse-glob_v3.0.4/flow_v0.45.0 +// flow-typed signature: ab83a04d76f98d02d2714231b8a0e223 +// flow-typed version: <>/parse-glob_v3.0.4/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/promise-retry_vx.x.x.js b/flow-typed/npm/promise-retry_vx.x.x.js index 22f1703..fe24cea 100644 --- a/flow-typed/npm/promise-retry_vx.x.x.js +++ b/flow-typed/npm/promise-retry_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: f4bcc1e4008bcbbe40f844fd22391e42 -// flow-typed version: <>/promise-retry_v1.1.1/flow_v0.45.0 +// flow-typed signature: cabfac81ad153f31bbc5931f75c869ee +// flow-typed version: <>/promise-retry_v1.1.1/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/flow-typed/npm/semantic-release_vx.x.x.js b/flow-typed/npm/semantic-release_vx.x.x.js index 01b3bd4..a409ced 100644 --- a/flow-typed/npm/semantic-release_vx.x.x.js +++ b/flow-typed/npm/semantic-release_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: e3ba45ad536b26a151bfb4ae65b832a5 -// flow-typed version: <>/semantic-release_v6.3.6/flow_v0.45.0 +// flow-typed signature: 92c6c02446dbf4d60e3a40825abe2704 +// flow-typed version: <>/semantic-release_v6.3.6/flow_v0.46.0 /** * This is an autogenerated libdef stub for: diff --git a/package.json b/package.json index 53d5e0c..76aa2f7 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "find-config": "1.0.0", "flow-runtime": "0.12.0", "graphql": "0.9.6", - "graphql-language-service-interface": "0.0.10", - "graphql-language-service-parser": "0.0.9", + "graphql-language-service-interface": "0.0.11", + "graphql-language-service-parser": "0.0.10", "invariant": "2.2.2", "json5": "0.5.1", "keymirror": "0.1.1", @@ -49,21 +49,20 @@ }, "devDependencies": { "babel-cli": "6.24.1", - "babel-eslint": "7.2.3", - "babel-jest": "20.0.0", + "babel-jest": "20.0.1", "babel-plugin-flow-runtime": "0.11.1", "babel-polyfill": "6.23.0", "babel-preset-playlyfe": "1.2.0", - "codecov": "2.1.0", + "codecov": "2.2.0", "commitizen": "2.9.6", - "cross-env": "4.0.0", + "cross-env": "5.0.0", "cz-conventional-changelog": "2.0.0", "eslint": "3.19.0", - "eslint-config-airbnb-base": "11.1.3", - "flow-bin": "0.45.0", + "eslint-plugin-playlyfe": "3.0.0", + "flow-bin": "0.46.0", "flow-typed": "2.1.2", "husky": "0.13.3", - "jest": "20.0.0", + "jest": "20.0.1", "memory-fs": "0.4.1", "semantic-release": "6.3.6" }, diff --git a/src/GQLService.js b/src/GQLService.js index 26db0cb..4858a96 100755 --- a/src/GQLService.js +++ b/src/GQLService.js @@ -72,7 +72,7 @@ export class GQLService { if (!this._isInitialized) { return []; } const schemaErrors = this._schemaBuilder.getSchemaErrors(); const queryErrors = this._queryManager ? this._queryManager.getErrors() : []; - return schemaErrors.concat(queryErrors.filter(err => Boolean(err))); + return schemaErrors.concat(queryErrors.filter((err) => Boolean(err))); } autocomplete(params: CommandParams): Array { diff --git a/src/__test-data__/utils.js b/src/__test-data__/utils.js index 24cd619..2919ed1 100644 --- a/src/__test-data__/utils.js +++ b/src/__test-data__/utils.js @@ -6,7 +6,7 @@ import splitLines from '../shared/splitLines'; export function getSchema() { jest.mock('../shared/watch'); const watch = require('../shared/watch').default; - const GQLService = require('../').GQLService; + const { GQLService } = require('../'); const gql = new GQLService({ cwd: path.resolve('src/__test-data__/') }); // $FlowDisableNextLine watch.__triggerChange(); @@ -20,12 +20,12 @@ export function getDefLocations() { end: { line: 16, column: 2 }, path: path.resolve('src/__test-data__/schema/query.gql'), }, - Player_id: { + Player_id: { // eslint-disable-line camelcase start: { line: 13, column: 3 }, end: { line: 13, column: 10 }, path: path.resolve('src/__test-data__/schema/query.gql'), }, - Player_image_arg_size: { + Player_image_arg_size: { // eslint-disable-line camelcase start: { line: 15, column: 9 }, end: { line: 15, column: 19 }, path: path.resolve('src/__test-data__/schema/query.gql'), @@ -52,17 +52,17 @@ export function getDefLocations() { end: { line: 5, column: 2 }, path: path.resolve('src/__test-data__/schema/mutation.gql'), }, - Mutation_PlayerCreate: { + Mutation_PlayerCreate: { // eslint-disable-line camelcase start: { line: 4, column: 3 }, end: { line: 4, column: 63 }, path: path.resolve('src/__test-data__/schema/mutation.gql'), }, - Mutation_PlayerCreateInput: { + Mutation_PlayerCreateInput: { // eslint-disable-line camelcase start: { line: 6, column: 1 }, end: { line: 9, column: 2 }, path: path.resolve('src/__test-data__/schema/mutation.gql'), }, - Mutation_PlayerCreateInput_id: { + Mutation_PlayerCreateInput_id: { // eslint-disable-line camelcase start: { line: 8, column: 3 }, end: { line: 8, column: 10 }, path: path.resolve('src/__test-data__/schema/mutation.gql'), @@ -73,7 +73,7 @@ export function getDefLocations() { end: { line: 6, column: 2 }, path: path.resolve('src/__test-data__/schema/query.gql'), }, - Query_viewer: { + Query_viewer: { // eslint-disable-line camelcase start: { line: 5, column: 3 }, end: { line: 5, column: 18 }, path: path.resolve('src/__test-data__/schema/query.gql'), @@ -96,7 +96,7 @@ export function getDefLocations() { end: { line: 7, column: 25 }, path: path.resolve('src/__test-data__/schema/directives.gql'), }, - customDirective_argIf: { + customDirective_argIf: { // eslint-disable-line camelcase start: { line: 4, column: 3 }, end: { line: 4, column: 15 }, path: path.resolve('src/__test-data__/schema/directives.gql'), diff --git a/src/__tests__/GQLService_findRefs.test.js b/src/__tests__/GQLService_findRefs.test.js index 9f68eac..f247fa7 100755 --- a/src/__tests__/GQLService_findRefs.test.js +++ b/src/__tests__/GQLService_findRefs.test.js @@ -2,7 +2,7 @@ import { code } from '../__test-data__/utils'; import runGQLService from './runGQLService'; -test('findRefs should return all references of token at given position', done => { +test('findRefs should return all references of token at given position', (done) => { const gql = runGQLService( { '/test/.gqlconfig': ` diff --git a/src/__tests__/GQLService_getDef.test.js b/src/__tests__/GQLService_getDef.test.js index 76a5d26..a87acc1 100755 --- a/src/__tests__/GQLService_getDef.test.js +++ b/src/__tests__/GQLService_getDef.test.js @@ -3,7 +3,7 @@ import { code } from '../__test-data__/utils'; import runGQLService from './runGQLService'; describe('Schema: getDef', () => { - it('works in schema files', done => { + it('works in schema files', (done) => { const gql = runGQLService( { '/test/.gqlconfig': ` @@ -84,7 +84,7 @@ describe('Schema: getDef', () => { }); describe('Query: getDef', () => { - it('works in query files', done => { + it('works in query files', (done) => { const gql = runGQLService( { '/test/.gqlconfig': ` diff --git a/src/__tests__/GQLService_getInfo.test.js b/src/__tests__/GQLService_getInfo.test.js index 6bf5e1e..4398a0f 100755 --- a/src/__tests__/GQLService_getInfo.test.js +++ b/src/__tests__/GQLService_getInfo.test.js @@ -3,7 +3,7 @@ import { code } from '../__test-data__/utils'; import runGQLService from './runGQLService'; describe('Schema: getDef', () => { - it('works in schema files', done => { + it('works in schema files', (done) => { const gql = runGQLService( { '/test/.gqlconfig': ` @@ -83,7 +83,7 @@ describe('Schema: getDef', () => { }); describe('Query: getDef', () => { - it('works in query files', done => { + it('works in query files', (done) => { const gql = runGQLService( { '/test/.gqlconfig': ` diff --git a/src/cli/rpc/Client.js b/src/cli/rpc/Client.js index a00e621..f8a1f5e 100644 --- a/src/cli/rpc/Client.js +++ b/src/cli/rpc/Client.js @@ -4,7 +4,7 @@ import ipc from 'node-ipc'; type Config = $Exact<{ serverName: string, - debug?: bool, + debug?: boolean, }>; export default class Client { diff --git a/src/cli/rpc/Server.js b/src/cli/rpc/Server.js index 6c31da1..e1f47bf 100755 --- a/src/cli/rpc/Server.js +++ b/src/cli/rpc/Server.js @@ -11,7 +11,7 @@ type MethodsMap = { type Config = $Exact<{ serverName: string, - debug?: bool, + debug?: boolean, }>; export default class Server { diff --git a/src/config/GQLConfig.js b/src/config/GQLConfig.js index 17a6303..570bbcb 100755 --- a/src/config/GQLConfig.js +++ b/src/config/GQLConfig.js @@ -9,7 +9,7 @@ import path from 'path'; import _uniq from 'lodash/uniq'; type Options = { - cwd?: string + cwd?: string, }; const CONFIG_FILE_NAME = '.gqlconfig'; @@ -149,7 +149,7 @@ function matchGlob(filePath, globs: Globs): boolean { } // matches any - return Boolean(globs.find(glob => minimatch(filePath, glob))); + return Boolean(globs.find((glob) => minimatch(filePath, glob))); } function matcher(filePath, match: FileMatchConfig): boolean { diff --git a/src/config/__tests__/GQLConfig.test.js b/src/config/__tests__/GQLConfig.test.js index 4c5f9c7..e9cb5ca 100644 --- a/src/config/__tests__/GQLConfig.test.js +++ b/src/config/__tests__/GQLConfig.test.js @@ -2,7 +2,7 @@ import GQLConfig from '../GQLConfig'; import path from 'path'; -const fixture = name => path.join(__dirname, 'fixtures', name); +const fixture = (name) => path.join(__dirname, 'fixtures', name); test('missing-gqlConfig: Report error if gqlconfig not found', () => { expect(() => { @@ -24,7 +24,7 @@ test('only-schema-gqlconfig: allow only schema', () => { describe('config.match', () => { const gqlConfig = new GQLConfig({ cwd: fixture('valid-gqlconfig') }); - const genPath = file => fixture(`valid-gqlconfig/${file}`); + const genPath = (file) => fixture(`valid-gqlconfig/${file}`); test('match schema files', () => { expect( diff --git a/src/index.js b/src/index.js index 8444af0..edbb610 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ /* @flow */ import packageJSON from '../package.json'; export { GQLService } from './GQLService'; -export const version = packageJSON.version; +export const { version } = packageJSON; diff --git a/src/query/QueryManager.js b/src/query/QueryManager.js index 3748b8e..f3f75b3 100644 --- a/src/query/QueryManager.js +++ b/src/query/QueryManager.js @@ -4,11 +4,7 @@ import fs from 'fs'; import { Source } from 'graphql/language/source'; -import { - type GQLError, - SEVERITY, - toGQLError, -} from '../shared/GQLError'; +import { type GQLError, SEVERITY, toGQLError } from '../shared/GQLError'; import validate from './validation/validate'; import parseQuery from './_shared/parseQuery'; @@ -16,10 +12,7 @@ import GQLConfig from '../config/GQLConfig'; import watch from '../shared/watch'; -import { - type ParsedFilesMap, - type WatchFile, -} from '../shared/types'; +import { type ParsedFilesMap, type WatchFile } from '../shared/types'; import { type GQLSchema } from '../shared/GQLTypes'; @@ -46,9 +39,11 @@ export class QueryManager { // watch schema files and rebuild schema const queryConfig = config.getQuery(); - if (!queryConfig) { return; } + if (!queryConfig) { + return; + } - queryConfig.files.map((fileConfig, index) => ( + queryConfig.files.map((fileConfig, index) => watch({ rootPath: config.getDir(), files: fileConfig.match, @@ -58,12 +53,16 @@ export class QueryManager { // console.log('init done'); if (!this._initialized) { this._initialized = true; - if (onInit) { onInit(); } + if (onInit) { + onInit(); + } + } + if (onChange) { + onChange(); } - if (onChange) { onChange(); } }, - }) - )); + }), + ); } getErrors(): Array { @@ -72,18 +71,20 @@ export class QueryManager { // private methods _updateFiles(files: Array, config: any) { - if (files.length === 0) { return; } + if (files.length === 0) { + return; + } // console.time('updating files'); files.forEach(({ name, exists }) => { // console.log(name, exists); const absPath = path.join(this._config.getDir(), name); - if (!exists) { - this._parsedFilesMap.delete(absPath); - } else { + if (exists) { // console.time('parseFile'); this._parsedFilesMap.set(absPath, this._parseFile(absPath, config)); // console.timeEnd('parseFile'); + } else { + this._parsedFilesMap.delete(absPath); } }); // console.timeEnd('updating files'); @@ -95,12 +96,18 @@ export class QueryManager { const schema = this._getSchema(); const errors = []; this._parsedFilesMap.forEach((parsedFile) => { - if (parsedFile.isEmpty) { return; } + if (parsedFile.isEmpty) { + return; + } if (parsedFile.error) { errors.push(parsedFile.error); } else { - const validationErrors = validate(schema, parsedFile.ast, parsedFile.config); + const validationErrors = validate( + schema, + parsedFile.ast, + parsedFile.config, + ); if (validationErrors) { errors.push(...validationErrors); } diff --git a/src/query/_shared/Parsers/QueryParser.js b/src/query/_shared/Parsers/QueryParser.js index 63bbec3..04dc8b1 100644 --- a/src/query/_shared/Parsers/QueryParser.js +++ b/src/query/_shared/Parsers/QueryParser.js @@ -23,7 +23,7 @@ function JSInlineFragment() { function eatJSInlineFragment(stream, state) { const { jsInlineFragment: frag } = state; invariant(frag, 'missing JSInlineFragment'); - stream.eatWhile(ch => { + stream.eatWhile((ch) => { if (frag.count === 0) { state.jsInlineFragment = null; return false; @@ -42,7 +42,7 @@ function eatJSInlineFragment(stream, state) { } const parserOptions = { - eatWhitespace: stream => stream.eatWhile(ch => isIgnored(ch) || ch === ';'), + eatWhitespace: (stream) => stream.eatWhile((ch) => isIgnored(ch) || ch === ';'), lexRules: { JSInlineFragment: /^\$\{/, ...LexRules, diff --git a/src/query/_shared/getTypeInfo.js b/src/query/_shared/getTypeInfo.js index ac060e4..fb18fce 100644 --- a/src/query/_shared/getTypeInfo.js +++ b/src/query/_shared/getTypeInfo.js @@ -1,12 +1,10 @@ /* @flow */ /* eslint-disable no-use-before-define, no-nested-ternary */ import { type TokenState } from '../../shared/types'; -import { forEachState } from 'graphql-language-service-interface/dist/autocompleteUtils'; import { - getNullableType, - GraphQLList, - isCompositeType, -} from 'graphql/type'; + forEachState, +} from 'graphql-language-service-interface/dist/autocompleteUtils'; +import { getNullableType, GraphQLList, isCompositeType } from 'graphql/type'; import { GQLDirective, @@ -18,7 +16,6 @@ import { type GQLType, type GQLNamedType, type GQLSchema, - SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, @@ -38,7 +35,10 @@ type Info = { // Utility for collecting rich type information given any token's state // from the graphql-mode parser. -export default function getTypeInfo(schema: GQLSchema, tokenState: TokenState): Info { +export default function getTypeInfo( + schema: GQLSchema, + tokenState: TokenState, +): Info { const info: Info = { type: null, parentType: null, @@ -51,7 +51,7 @@ export default function getTypeInfo(schema: GQLSchema, tokenState: TokenState): objectFieldDef: null, }; - forEachState(tokenState, (state) => { + forEachState(tokenState, (state) => { // eslint-disable-line complexity switch (state.kind) { case 'Query': case 'ShortQuery': @@ -71,11 +71,9 @@ export default function getTypeInfo(schema: GQLSchema, tokenState: TokenState): break; case 'Field': case 'AliasedField': - info.fieldDef = ( - info.type && state.name && info.parentType + info.fieldDef = info.type && state.name && info.parentType ? getFieldDef(schema, info.parentType, state.name) - : null - ); + : null; info.type = info.fieldDef && info.fieldDef.type; break; case 'SelectionSet': @@ -85,15 +83,18 @@ export default function getTypeInfo(schema: GQLSchema, tokenState: TokenState): info.directiveDef = state.name && schema.getDirective(state.name); break; case 'Arguments': - info.argDefs = - state.prevState.kind === 'Field' ? - info.fieldDef && info.fieldDef.args : - state.prevState.kind === 'Directive' ? - info.directiveDef && info.directiveDef.args : - state.prevState.kind === 'AliasedField' ? - state.prevState.name && - (getFieldDef(schema, (info.parentType: any), state.prevState.name): any).args : - null; + info.argDefs = state.prevState.kind === 'Field' + ? info.fieldDef && info.fieldDef.args + : state.prevState.kind === 'Directive' + ? info.directiveDef && info.directiveDef.args + : state.prevState.kind === 'AliasedField' + ? state.prevState.name && + (getFieldDef( + schema, + (info.parentType: any), + state.prevState.name, + ): any).args + : null; break; case 'Argument': info.argDef = null; @@ -109,24 +110,22 @@ export default function getTypeInfo(schema: GQLSchema, tokenState: TokenState): break; case 'ListValue': { const nullableType = getNullableType((info.inputType: any)); - info.inputType = nullableType instanceof GraphQLList ? - nullableType.ofType : - null; + info.inputType = nullableType instanceof GraphQLList + ? nullableType.ofType + : null; break; } case 'ObjectValue': { const objectType = getNamedType(info.inputType); - info.objectFieldDefs = ( - objectType instanceof GQLInputObjectType + info.objectFieldDefs = objectType instanceof GQLInputObjectType ? objectType.getFields() - : null - ); + : null; break; } case 'ObjectField': { - info.objectFieldDef = state.name && info.objectFieldDefs ? - info.objectFieldDefs[state.name] : - null; + info.objectFieldDef = state.name && info.objectFieldDefs + ? info.objectFieldDefs[state.name] + : null; info.inputType = info.objectFieldDef && info.objectFieldDef.type; break; } diff --git a/src/query/_shared/parseQuery.js b/src/query/_shared/parseQuery.js index 4bc8c31..6d58941 100644 --- a/src/query/_shared/parseQuery.js +++ b/src/query/_shared/parseQuery.js @@ -10,7 +10,7 @@ import debug from '../../shared/debug'; import MultilineCharacterStream from '../../shared/MultilineCharacterStream'; const IRREGULAR_WHITESPACE = '\f\v\u0085\u00A0\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000'; -const whiteSpaceString = text => text.replace(new RegExp(`[\\S${IRREGULAR_WHITESPACE}]`, 'g'), ' '); +const whiteSpaceString = (text) => text.replace(new RegExp(`[\\S${IRREGULAR_WHITESPACE}]`, 'g'), ' '); function placeholderFragment(text: string) { const fragmentName = 'F'; // dummy frag name diff --git a/src/query/commands/getHintsAtPosition.js b/src/query/commands/getHintsAtPosition.js index 317bea0..2d289df 100644 --- a/src/query/commands/getHintsAtPosition.js +++ b/src/query/commands/getHintsAtPosition.js @@ -28,7 +28,7 @@ import { import getTypeInfo from '../_shared/getTypeInfo'; import createRelaySchema from '../_shared/createRelaySchema'; -export default function getHintsAtPosition( +export default function getHintsAtPosition( // eslint-disable-line complexity _schema: GQLSchema, sourceText: string, _position: Position, @@ -47,7 +47,7 @@ export default function getHintsAtPosition( const schema = config.isRelay ? createRelaySchema(_schema) : _schema; const typeInfo = getTypeInfo(schema, token.state); - const state = token.state; + const { state } = token; const { kind, step } = state; // console.log(typeInfo); @@ -71,17 +71,17 @@ export default function getHintsAtPosition( // Field names if (kind === 'SelectionSet' || kind === 'Field' || kind === 'AliasedField') { if (typeInfo.parentType) { - const fields = typeInfo.parentType.getFields ? + const fields = typeInfo.parentType.getFields // $FlowDisableNextLine - objectValues(typeInfo.parentType.getFields()) : - []; + ? objectValues(typeInfo.parentType.getFields()) + : []; if (isAbstractType(typeInfo.parentType)) { fields.push(TypeNameMetaFieldDef); } if (typeInfo.parentType === schema.getQueryType()) { fields.push(SchemaMetaFieldDef, TypeMetaFieldDef); } - return fields.map(field => ({ + return fields.map((field) => ({ text: field.name, type: field.type.toString(), description: field.description, @@ -90,9 +90,9 @@ export default function getHintsAtPosition( } if (kind === 'Arguments' || (kind === 'Argument' && step === 0)) { - const argDefs = typeInfo.argDefs; + const { argDefs } = typeInfo; if (argDefs) { - return (argDefs.map(argDef => ({ + return (argDefs.map((argDef) => ({ text: argDef.name, type: argDef.type.toString(), description: argDef.description, @@ -104,7 +104,7 @@ export default function getHintsAtPosition( if (kind === 'ObjectValue' || (kind === 'ObjectField' && step === 0)) { if (typeInfo.objectFieldDefs) { const objectFields = objectValues(typeInfo.objectFieldDefs); - return (objectFields.map(field => ({ + return (objectFields.map((field) => ({ text: field.name, type: field.type.toString(), description: field.description, @@ -123,7 +123,7 @@ export default function getHintsAtPosition( if (namedInputType instanceof GQLEnumType) { const valueMap = namedInputType.getValues(); const values = objectValues(valueMap); - return (values.map(value => ({ + return (values.map((value) => ({ text: value.name, type: namedInputType.toString(), description: value.description, @@ -141,7 +141,7 @@ export default function getHintsAtPosition( (kind === 'TypeCondition' && step === 1) || (kind === 'NamedType' && state.prevState.kind === 'TypeCondition') ) { - let possibleTypes; + let possibleTypes = null; if (typeInfo.parentType) { if (isAbstractType(typeInfo.parentType)) { // Collect both the possible Object types as well as the interfaces @@ -163,7 +163,7 @@ export default function getHintsAtPosition( const typeMap = schema.getTypeMap(); possibleTypes = objectValues(typeMap).filter(isCompositeType); } - return possibleTypes.map(type => ({ + return possibleTypes.map((type) => ({ text: type.name, type: typeName[type.constructor.name], description: type.description, @@ -211,7 +211,7 @@ export default function getHintsAtPosition( ) { const inputTypeMap = schema.getTypeMap(); const inputTypes = objectValues(inputTypeMap).filter(isInputType); - return inputTypes.map(type => ({ + return inputTypes.map((type) => ({ text: type.name, description: type.description, })); @@ -220,9 +220,9 @@ export default function getHintsAtPosition( // Directive names if (kind === 'Directive') { const directives = schema.getDirectives().filter( - directive => canUseDirective(state.prevState.kind, directive), + (directive) => canUseDirective(state.prevState.kind, directive), ); - return directives.map(directive => ({ + return directives.map((directive) => ({ text: directive.name, description: directive.description, })); @@ -232,7 +232,7 @@ export default function getHintsAtPosition( } function canUseDirective(kind, directive) { - const locations = directive.locations; + const { locations } = directive; switch (kind) { case 'Query': return locations.indexOf('QUERY') !== -1; diff --git a/src/query/commands/getInfoOfTokenAtPosition.js b/src/query/commands/getInfoOfTokenAtPosition.js index 51fb431..867a34a 100644 --- a/src/query/commands/getInfoOfTokenAtPosition.js +++ b/src/query/commands/getInfoOfTokenAtPosition.js @@ -1,12 +1,6 @@ /* @flow */ -import { - type Position, - type GQLInfo, -} from '../../shared/types'; -import { - getNamedType, - type GQLSchema, -} from '../../shared/GQLTypes'; +import { type Position, type GQLInfo } from '../../shared/types'; +import { getNamedType, type GQLSchema } from '../../shared/GQLTypes'; import getTypeInfo from '../_shared/getTypeInfo'; import { type QueryParser } from '../../config/GQLConfig'; @@ -14,7 +8,7 @@ import { getTokenAtPosition } from '../_shared/getTokenAtPosition'; import createRelaySchema from '../_shared/createRelaySchema'; import debug from '../../shared/debug'; -function getInfoOfTokenAtPosition( +function getInfoOfTokenAtPosition( // eslint-disable-line complexity _schema: GQLSchema, sourceText: string, position: Position, @@ -28,7 +22,9 @@ function getInfoOfTokenAtPosition( const token = getTokenAtPosition(sourceText, position, config.parser); debug.timeEnd('getTokenAtPosition'); - if (!token) { return null; } + if (!token) { + return null; + } const { state } = token; const { kind, step } = state; @@ -53,13 +49,16 @@ function getInfoOfTokenAtPosition( } if (kind === 'Field' || kind === 'AliasedField') { - if (!typeInfo.fieldDef) { return null; } - const fieldDef = typeInfo.fieldDef; + if (!typeInfo.fieldDef) { + return null; + } + const { fieldDef } = typeInfo; const contents = []; contents.push(fieldDef.print()); - if (typeInfo.parentType && typeInfo.parentType.name === 'Mutation') { // include input args type + if (typeInfo.parentType && typeInfo.parentType.name === 'Mutation') { + // include input args type fieldDef.args.forEach((arg) => { const argType = getNamedType(arg.type); if (argType) { @@ -83,7 +82,9 @@ function getInfoOfTokenAtPosition( const contents = []; contents.push(argDef.print()); const type = getNamedType(argDef.type); - if (type) { contents.push(type.print()); } + if (type) { + contents.push(type.print()); + } return { contents }; } @@ -96,7 +97,9 @@ function getInfoOfTokenAtPosition( if (objectField) { contents.push(objectField.print()); const type = getNamedType(objectField.type); - if (type) { contents.push(type.print()); } + if (type) { + contents.push(type.print()); + } } return { contents }; } diff --git a/src/query/validation/rules/_shared/replaceRules.js b/src/query/validation/rules/_shared/replaceRules.js index cfdb153..1b63cee 100644 --- a/src/query/validation/rules/_shared/replaceRules.js +++ b/src/query/validation/rules/_shared/replaceRules.js @@ -6,7 +6,7 @@ const replaceRules = (allRules: Array, rulesToReplace: Array) => { return acc; }, {}); - return allRules.map(rule => map[rule.name] || rule); + return allRules.map((rule) => map[rule.name] || rule); }; export default replaceRules; diff --git a/src/query/validation/rules/gql-rules-query-relay/ScalarLeafs.js b/src/query/validation/rules/gql-rules-query-relay/ScalarLeafs.js index ff15bfd..da69b73 100644 --- a/src/query/validation/rules/gql-rules-query-relay/ScalarLeafs.js +++ b/src/query/validation/rules/gql-rules-query-relay/ScalarLeafs.js @@ -17,17 +17,17 @@ export { function isRelayPatternDirective(node) { if (node.name.value !== 'relay') { return false; } return Boolean( - node.arguments.find(argument => ( + node.arguments.find((argument) => ( argument.name.value === 'pattern' && argument.value.value === true )), ); } -function isFragmentPattern(node): bool { +function isFragmentPattern(node): boolean { return Boolean( node.directives - .find(directive => isRelayPatternDirective(directive)), + .find((directive) => isRelayPatternDirective(directive)), ); } @@ -36,7 +36,7 @@ function isFragmentPattern(node): bool { // 2) query { viewer } // valid in relay function ignore(node, ancestors) { const ancestorsReveresed = ancestors.slice(0, ancestors.length).reverse(); - const found = ancestorsReveresed.find(_node => ( + const found = ancestorsReveresed.find((_node) => ( _node.kind === 'OperationDefinition' || (_node.kind === 'FragmentDefinition' && isFragmentPattern(_node)) )); diff --git a/src/query/validation/validate.js b/src/query/validation/validate.js index 4baf5b9..51806b3 100644 --- a/src/query/validation/validate.js +++ b/src/query/validation/validate.js @@ -7,7 +7,7 @@ import createValidate from '../../shared/createValidate'; import _memoize from 'lodash/memoize'; import createRelaySchema from '../_shared/createRelaySchema'; -const getDefaultValidateConfig = _memoize(isRelay => ( +const getDefaultValidateConfig = _memoize((isRelay) => ( { extends: isRelay ? 'gql-rules-query-relay' : 'gql-rules-query' } )); diff --git a/src/schema/SchemaBuilder/GQLSchema.js b/src/schema/SchemaBuilder/GQLSchema.js index 6dcf4db..3882042 100755 --- a/src/schema/SchemaBuilder/GQLSchema.js +++ b/src/schema/SchemaBuilder/GQLSchema.js @@ -38,12 +38,12 @@ import { } from '../../shared/GQLTypes'; type GQLSchemaConfig = { - query: ?GQLObjectType; - mutation?: ?GQLObjectType; - subscription?: ?GQLObjectType; - types?: ?Array; - directives?: ?Array; - nodeMap: { [name: string]: TypeDefinitionNode }; + query: ?GQLObjectType, + mutation?: ?GQLObjectType, + subscription?: ?GQLObjectType, + types?: ?Array, + directives?: ?Array, + nodeMap: { [name: string]: TypeDefinitionNode }, }; export default class _GQLSchema { @@ -54,7 +54,7 @@ export default class _GQLSchema { _typeMap: { [typeName: string]: GQLNamedType } = {}; _implementations: { [interfaceName: string]: Array }; _possibleTypeMap: ?{ - [abstractName: string]: { [possibleName: string]: boolean } + [abstractName: string]: { [possibleName: string]: boolean }, }; _nodeMap: { [name: string]: TypeDefinitionNode }; @@ -176,7 +176,7 @@ export default class _GQLSchema { } getDirective(name: string): ?GQLDirective { - return find(this.getDirectives(), directive => directive.name === name); + return find(this.getDirectives(), (directive) => directive.name === name); } } @@ -221,7 +221,7 @@ function assertObjectImplementsInterface( // Assert each interface field arg is implemented. ifaceField.args.forEach((ifaceArg) => { const argName = ifaceArg.name; - const objectArg = find(objectField.args, arg => arg.name === argName); + const objectArg = find(objectField.args, (arg) => arg.name === argName); // Assert interface field arg exists on object field. if (!objectArg) { @@ -251,7 +251,7 @@ function assertObjectImplementsInterface( // Assert additional arguments must not be required. objectField.args.forEach((objectArg) => { const argName = objectArg.name; - const ifaceArg = find(ifaceField.args, arg => arg.name === argName); + const ifaceArg = find(ifaceField.args, (arg) => arg.name === argName); if (!ifaceArg && objectArg.type instanceof GraphQLNonNull) { errors.push(newGQLError( `${object.name}.${fieldName}(${argName}:) is of required type ` + @@ -266,7 +266,7 @@ function assertObjectImplementsInterface( if (missingFields.length > 0) { errors.push(newGQLError( - `Missing interface fields [${missingFields.map(field => field.name).join(', ')}]`, + `Missing interface fields [${missingFields.map((field) => field.name).join(', ')}]`, [object.node], SEVERITY.error, )); diff --git a/src/schema/SchemaBuilder/GQLSchemaBuilder.js b/src/schema/SchemaBuilder/GQLSchemaBuilder.js index ac4a935..2af6255 100644 --- a/src/schema/SchemaBuilder/GQLSchemaBuilder.js +++ b/src/schema/SchemaBuilder/GQLSchemaBuilder.js @@ -9,22 +9,14 @@ import { GraphQLSchema } from 'graphql/type'; import { buildASTSchema } from './buildASTSchema'; import { buildASTSchema as buildASTGraphQLSchema } from 'graphql/utilities'; - -import { - type GQLError, - SEVERITY, - toGQLError, -} from '../../shared/GQLError'; +import { type GQLError, SEVERITY, toGQLError } from '../../shared/GQLError'; import { validate } from '../../schema'; import GQLConfig from '../../config/GQLConfig'; import watch from '../../shared/watch'; -import { - type ParsedFilesMap, - type WatchFile, -} from '../../shared/types'; +import { type ParsedFilesMap, type WatchFile } from '../../shared/types'; import { type GQLSchema } from '../../shared/GQLTypes'; import { type DocumentNode } from 'graphql/language/ast'; @@ -64,7 +56,9 @@ export default class GQLSchemaBuilder { } } - if (onChange) { onChange(); } + if (onChange) { + onChange(); + } if (!options.watch) { watchClient.end(); } @@ -86,23 +80,27 @@ export default class GQLSchemaBuilder { // private methods _updateFiles(files: Array, config: any) { - if (files.length === 0) { return; } + if (files.length === 0) { + return; + } // console.time('updating files'); files.forEach(({ name, exists }) => { // console.log(name, exists); const absPath = path.join(this._config.getDir(), name); - if (!exists) { - this._parsedFilesMap.delete(absPath); - } else { + if (exists) { this._parsedFilesMap.set(absPath, this._parseFile(absPath)); + } else { + this._parsedFilesMap.delete(absPath); } }); // console.timeEnd('updating files'); // build merged ast // console.time('buildAST'); - const { ast, errors: parseErrors } = this._buildASTFromParsedFiles(this._parsedFilesMap); + const { ast, errors: parseErrors } = this._buildASTFromParsedFiles( + this._parsedFilesMap, + ); // console.timeEnd('buildAST'); // build GQLSchema from ast @@ -118,11 +116,7 @@ export default class GQLSchemaBuilder { this._ast = ast; this._schema = schema; - this._errors = [ - ...parseErrors, - ...buildErrors, - ...validationErrors, - ]; + this._errors = [...parseErrors, ...buildErrors, ...validationErrors]; } _parseFile = (absPath: string) => { @@ -145,13 +139,14 @@ export default class GQLSchemaBuilder { _buildASTFromParsedFiles = (parsedFiles: ParsedFilesMap) => { const mergedDefinitions = []; const errors = []; - for (const parsedFile of parsedFiles.values()) { // eslint-disable-line no-restricted-syntax + for (const parsedFile of parsedFiles.values()) { + // eslint-disable-line no-restricted-syntax const { ast, error } = parsedFile; - if (!error) { - const definitions = ast.definitions; - mergedDefinitions.push(...definitions); - } else { + if (error) { errors.push(error); + } else { + const { definitions } = ast; + mergedDefinitions.push(...definitions); } } diff --git a/src/schema/SchemaBuilder/PlaceholderTypes.js b/src/schema/SchemaBuilder/PlaceholderTypes.js index f01b00b..df4bcb3 100644 --- a/src/schema/SchemaBuilder/PlaceholderTypes.js +++ b/src/schema/SchemaBuilder/PlaceholderTypes.js @@ -5,22 +5,21 @@ import { GQLInterfaceType, } from '../../shared/GQLTypes'; -const genUnknownScalarType = (name: string) => ( +const genUnknownScalarType = (name: string) => new GQLScalarType(null, { name, description: `Unknown scalar type '${name}'`, serialize: () => null, parseValue: () => false, parseLiteral: () => false, - }) -); + }); // will be used to provide definition for unknown types export const PLACEHOLDER_TYPES = { scalarType: genUnknownScalarType, inputType: genUnknownScalarType, outputType: genUnknownScalarType, - objectType: (name: string) => ( + objectType: (name: string) => new GQLObjectType(null, { name, description: `unknown type '${name}'`, @@ -28,16 +27,14 @@ export const PLACEHOLDER_TYPES = { name: { type: genUnknownScalarType('unknown') }, }, interfaces: () => null, - }) - ), - interfaceType: (name: string) => ( + }), + interfaceType: (name: string) => new GQLInterfaceType(null, { name, description: `unknown interface type '${name}'`, fields: { unknown: { type: genUnknownScalarType('unknown') }, }, - resolveType: () => {}, - }) - ), + resolveType: () => {}, // eslint-disable-line no-empty-function + }), }; diff --git a/src/schema/SchemaBuilder/buildASTSchema.js b/src/schema/SchemaBuilder/buildASTSchema.js index f891c7f..a8a6c94 100755 --- a/src/schema/SchemaBuilder/buildASTSchema.js +++ b/src/schema/SchemaBuilder/buildASTSchema.js @@ -77,8 +77,10 @@ import { GraphQLObjectType, } from 'graphql/type/definition'; -import { // eslint-disable-line no-duplicate-imports -type DirectiveLocationEnum } from 'graphql/type/directives'; +import { + // eslint-disable-line no-duplicate-imports + type DirectiveLocationEnum, +} from 'graphql/type/directives'; // import { // __Schema, @@ -91,11 +93,7 @@ type DirectiveLocationEnum } from 'graphql/type/directives'; // __TypeKind, // } from 'graphql/type/introspection'; -import { - type GQLError, - SEVERITY, - newGQLError, -} from '../../shared/GQLError'; +import { type GQLError, SEVERITY, newGQLError } from '../../shared/GQLError'; import { PLACEHOLDER_TYPES } from './PlaceholderTypes'; @@ -104,7 +102,9 @@ function buildWrappedType( inputTypeAST: TypeNode, ): GQLType { if (inputTypeAST.kind === LIST_TYPE) { - return new GraphQLList((buildWrappedType(innerType, inputTypeAST.type): any)); + return new GraphQLList( + (buildWrappedType(innerType, inputTypeAST.type): any), + ); } if (inputTypeAST.kind === NON_NULL_TYPE) { const wrappedType = buildWrappedType(innerType, inputTypeAST.type); @@ -114,13 +114,16 @@ function buildWrappedType( return (innerType: any); } -export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: Array } { - let schemaDef: ?SchemaDefinitionNode; - +export function buildASTSchema( // eslint-disable-line complexity + ast: DocumentNode, +): { schema: GQLSchema, errors: Array } { + let schemaDef: ?SchemaDefinitionNode = null; const errors: Array = []; const typeDefs: Array = []; - const nodeMap: {[name: string]: TypeDefinitionNode} = Object.create(null); - const nodeMapWithAllReferences: {[name: string]: Array} = Object.create(null); + const nodeMap: { [name: string]: TypeDefinitionNode } = Object.create(null); + const nodeMapWithAllReferences: { + [name: string]: Array, + } = Object.create(null); const directiveDefs: Array = []; for (let i = 0; i < ast.definitions.length; i += 1) { @@ -128,11 +131,13 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: switch (d.kind) { case SCHEMA_DEFINITION: if (schemaDef) { - errors.push(newGQLError( - 'Must provide only one schema definition.', - [schemaDef, d], - SEVERITY.error, - )); + errors.push( + newGQLError( + 'Must provide only one schema definition.', + [schemaDef, d], + SEVERITY.error, + ), + ); } schemaDef = d; break; @@ -148,7 +153,9 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: nodeMap[name] = d; } // storing all reference to detect multiple defintition with same name - if (!nodeMapWithAllReferences[name]) { nodeMapWithAllReferences[name] = []; } + if (!nodeMapWithAllReferences[name]) { + nodeMapWithAllReferences[name] = []; + } nodeMapWithAllReferences[name].push(d); break; } @@ -162,17 +169,19 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: // error for multi same name typeDef Object.keys(nodeMapWithAllReferences).forEach((name) => { if (nodeMapWithAllReferences[name].length > 1) { - errors.push(newGQLError( - `Schema must contain unique named types but contains multiple types named "${name}".`, - nodeMapWithAllReferences[name].map(typeDefAST => typeDefAST.name), - SEVERITY.error, - )); + errors.push( + newGQLError( + `Schema must contain unique named types but contains multiple types named "${name}".`, + nodeMapWithAllReferences[name].map((typeDefAST) => typeDefAST.name), + SEVERITY.error, + ), + ); } }); - let queryTypeName; - let mutationTypeName; - let subscriptionTypeName; + let queryTypeName = null; + let mutationTypeName = null; + let subscriptionTypeName = null; if (schemaDef) { schemaDef.operationTypes.forEach((operationType) => { @@ -198,11 +207,13 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: } if (!queryTypeName) { - errors.push(newGQLError( - 'Must provide schema definition with query type or a type named Query.', - null, - SEVERITY.error, - )); + errors.push( + newGQLError( + 'Must provide schema definition with query type or a type named Query.', + null, + SEVERITY.error, + ), + ); } const innerTypeMap = { @@ -213,7 +224,9 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: ID: GQLID, }; - const types = typeDefs.map(def => typeDefNamed(def.name.value, def)).filter(Boolean); + const types = typeDefs + .map((def) => typeDefNamed(def.name.value, def)) + .filter(Boolean); // Adding default types types.push( @@ -228,22 +241,26 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: const directives = directiveDefs.map(getDirective); // If specified directives were not explicitly declared, add them. - if (!directives.some(directive => directive.name === 'skip')) { + if (!directives.some((directive) => directive.name === 'skip')) { directives.push(GQLSkipDirective); } - if (!directives.some(directive => directive.name === 'include')) { + if (!directives.some((directive) => directive.name === 'include')) { directives.push(GQLIncludeDirective); } - if (!directives.some(directive => directive.name === 'deprecated')) { + if (!directives.some((directive) => directive.name === 'deprecated')) { directives.push(GQLDeprecatedDirective); } const schema = new GQLSchema({ query: queryTypeName ? getObjectType(nodeMap[queryTypeName]) : null, - mutation: mutationTypeName ? getObjectType(nodeMap[mutationTypeName]) : null, - subscription: subscriptionTypeName ? getObjectType(nodeMap[subscriptionTypeName]) : null, + mutation: mutationTypeName + ? getObjectType(nodeMap[mutationTypeName]) + : null, + subscription: subscriptionTypeName + ? getObjectType(nodeMap[subscriptionTypeName]) + : null, types, directives, nodeMap, @@ -256,7 +273,7 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: name: directiveNode.name.value, description: getDescription(directiveNode), locations: directiveNode.locations.map( - node => ((node.value: any): DirectiveLocationEnum), + (node) => ((node.value: any): DirectiveLocationEnum), ), args: directiveNode.arguments && makeInputValues(directiveNode.arguments), }); @@ -266,11 +283,13 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: const type = typeDefNamed(typeNode.name.value, typeNode); if (!(type instanceof GraphQLObjectType)) { - errors.push(newGQLError( - 'AST must provide object type.', - [typeNode], - SEVERITY.error, - )); + errors.push( + newGQLError( + 'AST must provide object type.', + [typeNode], + SEVERITY.error, + ), + ); } return (type: any); @@ -286,11 +305,9 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: if (!nodeMap[typeName]) { // NOT found - errors.push(newGQLError( - `Type "${typeName}" not found.`, - [node], - SEVERITY.error, - )); + errors.push( + newGQLError(`Type "${typeName}" not found.`, [node], SEVERITY.error), + ); return null; } @@ -304,21 +321,27 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: // return Boolean(innerTypeMap[getNamedTypeNode(typeNode).name.value]); // } - function produceType(typeNode: TypeNode, defaultValue: (name: string) => GraphQLType): GQLType { + function produceType( + typeNode: TypeNode, + defaultValue: (name: string) => GraphQLType, + ): GQLType { const namedTypeNode = getNamedTypeNode(typeNode); const typeName = namedTypeNode.name.value; - const typeDef = typeDefNamed(typeName, namedTypeNode) || defaultValue(typeName); + const typeDef = + typeDefNamed(typeName, namedTypeNode) || defaultValue(typeName); return buildWrappedType(typeDef, typeNode); } function produceInputType(typeNode: TypeNode): GraphQLInputType { const type = produceType(typeNode, PLACEHOLDER_TYPES.inputType); if (!isInputType((type: any))) { - errors.push(newGQLError( - 'Expected Input type.', - [getNamedTypeNode(typeNode)], - SEVERITY.error, - )); + errors.push( + newGQLError( + 'Expected Input type.', + [getNamedTypeNode(typeNode)], + SEVERITY.error, + ), + ); } return (type: any); } @@ -326,11 +349,13 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: function produceOutputType(typeNode: TypeNode): GraphQLOutputType { const type = produceType(typeNode, PLACEHOLDER_TYPES.outputType); if (!isOutputType((type: any))) { - errors.push(newGQLError( - 'Expected Output type.', - [getNamedTypeNode(typeNode)], - SEVERITY.error, - )); + errors.push( + newGQLError( + 'Expected Output type.', + [getNamedTypeNode(typeNode)], + SEVERITY.error, + ), + ); } return (type: any); } @@ -338,11 +363,13 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: function produceObjectType(typeNode: TypeNode): GQLObjectType { const type = produceType(typeNode, PLACEHOLDER_TYPES.objectType); if (!(type instanceof GraphQLObjectType)) { - errors.push(newGQLError( - 'Expected Object type.', - [getNamedTypeNode(typeNode)], - SEVERITY.error, - )); + errors.push( + newGQLError( + 'Expected Object type.', + [getNamedTypeNode(typeNode)], + SEVERITY.error, + ), + ); } return (type: any); } @@ -350,11 +377,13 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: function produceInterfaceType(typeNode: TypeNode): GQLInterfaceType { const type = produceType(typeNode, PLACEHOLDER_TYPES.interfaceType); if (!(type instanceof GraphQLInterfaceType)) { - errors.push(newGQLError( - 'Expected Interface type.', - [getNamedTypeNode(typeNode)], - SEVERITY.error, - )); + errors.push( + newGQLError( + 'Expected Interface type.', + [getNamedTypeNode(typeNode)], + SEVERITY.error, + ), + ); } return (type: any); } @@ -396,8 +425,8 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: ) { return keyValMap( def.fields, - field => field.name.value, - field => ({ + (field) => field.name.value, + (field) => ({ type: produceOutputType(field.type), node: field, description: getDescription(field), @@ -408,13 +437,15 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: } function makeImplementedInterfaces(def: ObjectTypeDefinitionNode) { - return def.interfaces && def.interfaces.map(iface => produceInterfaceType(iface)); + return ( + def.interfaces && def.interfaces.map((iface) => produceInterfaceType(iface)) + ); } function makeInputValues(values: Array) { return keyValMap( values, - value => value.name.value, + (value) => value.name.value, (value) => { const type = produceInputType(value.type); return { @@ -443,8 +474,8 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: description: getDescription(def), values: keyValMap( def.values, - enumValue => enumValue.name.value, - enumValue => ({ + (enumValue) => enumValue.name.value, + (enumValue) => ({ description: getDescription(enumValue), deprecationReason: getDeprecationReason(enumValue.directives), node: enumValue, @@ -459,7 +490,7 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: return new GQLUnionType(def, { name: def.name.value, description: getDescription(def), - types: def.types.map(t => produceObjectType(t)), + types: def.types.map((t) => produceObjectType(t)), resolveType: cannotExecuteSchema, }); } @@ -488,17 +519,16 @@ export function buildASTSchema(ast: DocumentNode): { schema: GQLSchema, errors: } function getDeprecationReason(directives: ?Array): ?string { - const deprecatedAST = directives && find( - directives, - directive => directive.name.value === GQLDeprecatedDirective.name, - ); + const deprecatedAST = + directives && + find( + directives, + (directive) => directive.name.value === GQLDeprecatedDirective.name, + ); if (!deprecatedAST) { return null; } - const { reason } = getArgumentValues( - GQLDeprecatedDirective, - deprecatedAST, - ); + const { reason } = getArgumentValues(GQLDeprecatedDirective, deprecatedAST); return (reason: any); } @@ -507,30 +537,35 @@ function getDeprecationReason(directives: ?Array): ?string { * block full-line of comments preceding it. */ export function getDescription(node: { loc?: Location }): ?string { - const loc = node.loc; - if (!loc) { return null; } + const { loc } = node; + if (!loc) { + return null; + } const comments = []; - let minSpaces; + let minSpaces = null; let token = loc.startToken.prev; while ( token && token.kind === TokenKind.COMMENT && - token.next && token.prev && + token.next && + token.prev && token.line + 1 === token.next.line && token.line !== token.prev.line ) { const value = String(token.value); const spaces = leadingSpaces(value); - if (minSpaces === undefined || spaces < minSpaces) { + if (minSpaces === null || spaces < minSpaces) { minSpaces = spaces; } comments.push(value); token = token.prev; } - return comments - .reverse() - .map(comment => comment.slice(minSpaces)) - .join('\n'); + return ( + comments + .reverse() + .map((comment) => comment.slice(minSpaces)) + .join('\n') + ); } // Count the number of spaces on the starting side of a string. diff --git a/src/schema/_shared/SchemaParser.js b/src/schema/_shared/SchemaParser.js index a03f5e3..a19feac 100644 --- a/src/schema/_shared/SchemaParser.js +++ b/src/schema/_shared/SchemaParser.js @@ -11,7 +11,7 @@ class SchemaParser { constructor() { this._parser = onlineParser({ - eatWhitespace: stream => stream.eatWhile(isIgnored), + eatWhitespace: (stream) => stream.eatWhile(isIgnored), lexRules: LexRules, parseRules: ParseRules, }); diff --git a/src/schema/commands/findRefsOfTokenAtPosition.js b/src/schema/commands/findRefsOfTokenAtPosition.js index ed3ec1a..2e58aee 100644 --- a/src/schema/commands/findRefsOfTokenAtPosition.js +++ b/src/schema/commands/findRefsOfTokenAtPosition.js @@ -1,9 +1,6 @@ /* @flow */ import { getTokenAtPosition } from '../_shared/getTokenAtPosition'; -import { - type Position, - type DefLocation, -} from '../../shared/types'; +import { type Position, type DefLocation } from '../../shared/types'; import { type GQLSchema } from '../../shared/GQLTypes'; import getDefLocationForNode from '../../shared/getDefLocationForNode'; @@ -20,7 +17,9 @@ function findRefsOfTokenAtPosition( const token = getTokenAtPosition(sourceText, position); // console.timeEnd('getTokenAtPosition'); // console.log('token', token); - if (!token) { return []; } + if (!token) { + return []; + } const { state } = token; @@ -30,14 +29,13 @@ function findRefsOfTokenAtPosition( (state.kind === 'UnionMember' && state.step === 1) || // union Type = Type1 | Type2<------ (state.kind === 'Implements' && state.step === 1) ) { - const name = state.name; + const { name } = state; const type = schema.getType(name); if (type) { - const locations = ( - type.dependents.concat(type.node && type.node.name) // include definition also - .map(getDefLocationForNode) - .filter(defLocation => Boolean(defLocation)) - ); + const locations = type.dependents + .concat(type.node && type.node.name) // include definition also + .map(getDefLocationForNode) + .filter((defLocation) => Boolean(defLocation)); // 'any' Flow not able to detect we are filtering nul values return (locations: any); } diff --git a/src/schema/commands/getDefinitionAtPosition.js b/src/schema/commands/getDefinitionAtPosition.js index cdc10fd..36f50f7 100644 --- a/src/schema/commands/getDefinitionAtPosition.js +++ b/src/schema/commands/getDefinitionAtPosition.js @@ -1,8 +1,5 @@ /* @flow */ -import { - type Position, - type DefLocation, -} from '../../shared/types'; +import { type Position, type DefLocation } from '../../shared/types'; import { type GQLSchema } from '../../shared/GQLTypes'; import { getTokenAtPosition } from '../_shared/getTokenAtPosition'; import getDefLocationForNode from '../../shared/getDefLocationForNode'; @@ -18,7 +15,9 @@ function getDefinitionAtPosition( const token = getTokenAtPosition(sourceText, position); // console.timeEnd('getTokenAtPosition'); // console.log('token', token); - if (!token) { return null; } + if (!token) { + return null; + } const { state } = token; @@ -30,7 +29,7 @@ function getDefinitionAtPosition( (state.kind === 'UnionMember' && state.step === 1) || // union Type = Type1 | Type2<------ (state.kind === 'Implements' && state.step === 1) ) { - const name = state.name; + const { name } = state; const type = schema.getType(name); if (type) { return getDefLocationForNode(type.node); diff --git a/src/schema/commands/getHintsAtPosition.js b/src/schema/commands/getHintsAtPosition.js index cf6e1e4..1c0bc0b 100755 --- a/src/schema/commands/getHintsAtPosition.js +++ b/src/schema/commands/getHintsAtPosition.js @@ -1,8 +1,5 @@ /* @flow */ -import { - isInputType, - isOutputType, -} from 'graphql/type/definition'; +import { isInputType, isOutputType } from 'graphql/type/definition'; import { getTokenAtPosition } from './../_shared/getTokenAtPosition'; import { @@ -36,27 +33,28 @@ function getHintsForTokenState( state: TokenState, token: Token, ): Array { - if (!state) { return []; } + if (!state) { + return []; + } const { kind, step } = state; // console.log(kind, step); if (kind === 'Document' && step === 0) { - return [ - { text: 'type' }, - { text: 'enum' }, - { text: 'input' }, - ]; + return [{ text: 'type' }, { text: 'enum' }, { text: 'input' }]; } /** ****************** type *******************/ // type name { // field: <--- // } - if (kind === 'FieldDef' && ( - step === 3 || // case field: <---- cursor here - (step === 4 && isAlphabet(token.prevChar) && token.style === 'punctuation') // field: Type! when cursor on ! - )) { + if ( + kind === 'FieldDef' && + (step === 3 || // case field: <---- cursor here + (step === 4 && + isAlphabet(token.prevChar) && + token.style === 'punctuation')) // field: Type! when cursor on ! + ) { const typeMap = schema.getTypeMap(); return Object.keys(typeMap).reduce((acc, key) => { if (isOutputType(typeMap[key])) { @@ -100,8 +98,11 @@ function getHintsForTokenState( // } if ( (kind === 'InputValueDef' && step === 2) || - (kind === 'InputValueDef' && step === 3 && isAlphabet(token.prevChar) && token.style === 'punctuation') || - (kind === 'FieldDef' && step === 2 && token.string === ')') // case name(first: ) // when cursor on closing bracket ')' + (kind === 'InputValueDef' && + step === 3 && + isAlphabet(token.prevChar) && + token.style === 'punctuation') || + (kind === 'FieldDef' && step === 2 && token.string === ')') // case name(first: ) // when cursor on closing bracket ')' ) { const typeMap = schema.getTypeMap(); return Object.keys(typeMap).reduce((acc, key) => { @@ -128,11 +129,14 @@ function getHintsForTokenState( // -------^ // } - if (kind === 'ListType' && ( - step === 1 || - ((step === 3 || step === 2) && isAlphabet(token.prevChar) && token.style === 'punctuation') - )) { - const prevState = state.prevState; // { Kind: Type } + if ( + kind === 'ListType' && + (step === 1 || + ((step === 3 || step === 2) && + isAlphabet(token.prevChar) && + token.style === 'punctuation')) + ) { + const { prevState } = state; // { Kind: Type } return getHintsForTokenState(schema, prevState.prevState, token); } /** ************** List ****************/ @@ -144,7 +148,11 @@ function getHintsForTokenState( (kind === 'NamedType' && step === 0) || (kind === 'NamedType' && step === 1 && isAlphabet(token.prevChar)) ) { - return getHintsForTokenState(schema, state.prevState.prevState.prevState, token); + return getHintsForTokenState( + schema, + state.prevState.prevState.prevState, + token, + ); } /** ********************************************** diff --git a/src/schema/commands/getInfoOfTokenAtPosition.js b/src/schema/commands/getInfoOfTokenAtPosition.js index 4888a70..d0264f5 100644 --- a/src/schema/commands/getInfoOfTokenAtPosition.js +++ b/src/schema/commands/getInfoOfTokenAtPosition.js @@ -1,8 +1,5 @@ /* @flow */ -import { - type Position, - type GQLInfo, -} from '../../shared/types'; +import { type Position, type GQLInfo } from '../../shared/types'; import { type GQLSchema } from '../../shared/GQLTypes'; import { getTokenAtPosition } from '../_shared/getTokenAtPosition'; @@ -17,7 +14,9 @@ function getInfoOfTokenAtPosition( const token = getTokenAtPosition(sourceText, position); // console.timeEnd('getTokenAtPosition'); // console.log('token', token); - if (!token) { return null; } + if (!token) { + return null; + } const { state } = token; // console.log(state, token); @@ -28,7 +27,7 @@ function getInfoOfTokenAtPosition( (state.kind === 'UnionMember' && state.step === 1) || // union Type = Type1 | Type2<------ (state.kind === 'Implements' && state.step === 1) ) { - const name = state.name; + const { name } = state; const type = schema.getType(name); if (type) { return { contents: [type.print()] }; diff --git a/src/shared/GQLError.js b/src/shared/GQLError.js index e9ffd74..1dd497e 100755 --- a/src/shared/GQLError.js +++ b/src/shared/GQLError.js @@ -14,7 +14,7 @@ export type GQLError = { severity: string, // if locations is missing then error is not in single file // e.g Schema needs 'query' defined in some file - locations: ?Array + locations: ?Array, }; function patchLocation({ line, column }, source): Location { @@ -35,7 +35,7 @@ function cleanMessage(message) { // NOTE: patched error locations to add file path function patchLocationsUsingNodes(locations, nodes): Array { - const errorNodes = nodes.filter(node => node.loc); + const errorNodes = nodes.filter((node) => node.loc); if (locations) { return locations.reduce((acc, location, index) => { const errorNode = errorNodes[index]; @@ -53,7 +53,7 @@ function patchLocationsUsingSource(locations, source): Array { } function patchLocations(error: GraphQLError) { - let locations; + let locations = null; if (error.nodes && error.nodes.length > 0) { // NOTE: here nodes can be in differenct files locations = patchLocationsUsingNodes(error.locations, error.nodes); diff --git a/src/shared/GQLTypes.js b/src/shared/GQLTypes.js index ca34bce..e1ee15d 100644 --- a/src/shared/GQLTypes.js +++ b/src/shared/GQLTypes.js @@ -62,37 +62,36 @@ export type GQLField = { }; export type GQLInputField = { - name: string; + name: string, // $FlowDisableNextLine - type: GQLInputType; - defaultValue?: mixed; - description?: ?string; + type: GQLInputType, + defaultValue?: mixed, + description?: ?string, node: InputValueDefinitionNode, print: () => string, }; type GQLInputFieldMap = { // $FlowDisableNextLine - [fieldname: string]: GQLInputField; + [fieldname: string]: GQLInputField, }; type GQLFieldMap = { // $FlowDisableNextLine - [fieldname: string]: GQLField; + [fieldname: string]: GQLField, }; export interface GQLSchema { // eslint-disable-line - getQueryType(): ?GQLObjectType; - getMutationType(): ?GQLObjectType; - getSubscriptionType(): ?GQLObjectType; + getQueryType(): ?GQLObjectType, + getMutationType(): ?GQLObjectType, + getSubscriptionType(): ?GQLObjectType, - getType(name: string): ?GQLNamedType; - getTypeMap(): { [name: string]: GQLNamedType }; - getType(name: string): GQLNamedType; + getType(name: string): ?GQLNamedType, + getTypeMap(): { [name: string]: GQLNamedType }, - getDirective(name: string): ?GraphQLDirective; - getDirectives(): Array; - getPossibleTypes(type: any): Array; + getDirective(name: string): ?GraphQLDirective, + getDirectives(): Array, + getPossibleTypes(type: any): Array, // NOTE: not available in graphql-js (npm) [added in our custom GraphqlSchema] // getTypeNode(name: string): ?TypeDefinitionNode; @@ -180,7 +179,7 @@ const [SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef] = [ _SchemaMetaFieldDef, _TypeMetaFieldDef, _TypeNameMetaFieldDef, -].map(field => { +].map((field) => { const type = getNamedType(field.type); type.print = memoize(() => printType(type)); @@ -206,7 +205,7 @@ const [SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef] = [ const lines = printedType.split('\n'); return lines .slice(1, lines.length - 1) // remove first and last line which is type we need field only - .map(line => line.trim()) + .map((line) => line.trim()) .join('\n'); }), }; @@ -218,7 +217,7 @@ function printArg(arg, indentation = '') { return [ `${indentation}${printDescription(arg.description)}`, `${indentation}${arg.name}: ${arg.type.toString()}`, - ].filter(val => val && val.trim()).join('\n'); + ].filter((val) => val && val.trim()).join('\n'); } function printArgs(args) { @@ -226,7 +225,7 @@ function printArgs(args) { return ''; } - const argsStr = args.map(arg => printArg(arg, ' ')).join('\n'); + const argsStr = args.map((arg) => printArg(arg, ' ')).join('\n'); return `(\n${argsStr}\n)`; } @@ -254,8 +253,8 @@ export class GQLDirective extends GraphQLDirective { printDescription(this.description), `directive @${this.name}${printArgs(this.args)}`, ` on ${this.locations.join('\n | ')}`, - ].filter(val => val).join('\n'); - }) + ].filter((val) => val).join('\n'); + }); } function reduceArgs(args) { @@ -293,7 +292,7 @@ export class GQLScalarType extends GraphQLScalarType { this.node = node; } - print = memoize((): string => print(this.node, this.description)) + print = memoize((): string => print(this.node, this.description)); } export class GQLObjectType extends GraphQLObjectType { @@ -316,7 +315,7 @@ export class GQLObjectType extends GraphQLObjectType { return (_fields: any); } - print = memoize((): string => print(this.node, this.description)) + print = memoize((): string => print(this.node, this.description)); } export class GQLInterfaceType extends GraphQLInterfaceType { @@ -335,7 +334,7 @@ export class GQLInterfaceType extends GraphQLInterfaceType { return (_fields: any); } - print = memoize((): string => print(this.node, this.description)) + print = memoize((): string => print(this.node, this.description)); } export class GQLUnionType extends GraphQLUnionType { @@ -347,7 +346,7 @@ export class GQLUnionType extends GraphQLUnionType { this.node = node; } - print = memoize((): string => print(this.node, this.description)) + print = memoize((): string => print(this.node, this.description)); } export class GQLEnumType extends GraphQLEnumType { @@ -359,7 +358,7 @@ export class GQLEnumType extends GraphQLEnumType { this.node = node; } - print = memoize((): string => print(this.node, this.description)) + print = memoize((): string => print(this.node, this.description)); } export class GQLInputObjectType extends GraphQLInputObjectType { @@ -371,7 +370,7 @@ export class GQLInputObjectType extends GraphQLInputObjectType { this.node = node; } - print = memoize((): string => print(this.node, this.description)) + print = memoize((): string => print(this.node, this.description)); getFields(): GQLInputFieldMap { if (this._fields) { return this._fields; } @@ -409,23 +408,19 @@ export type GQLOutputType = GQLUnionType | GQLEnumType | GQLList | - GQLNonNull< - GQLScalarType | + GQLNonNull - >; + GQLList>; export type GQLInputType = GQLScalarType | GQLEnumType | GQLInputObjectType | GQLList | - GQLNonNull< - GQLScalarType | + GQLNonNull - >; + GQLList>; diff --git a/src/shared/MultilineCharacterStream.js b/src/shared/MultilineCharacterStream.js index 006b1ad..ad9c1d1 100644 --- a/src/shared/MultilineCharacterStream.js +++ b/src/shared/MultilineCharacterStream.js @@ -41,8 +41,9 @@ export default class MultilineCharacterStream { } peek(): string | null { - return this._sourceText.charAt(this._pos) ? - this._sourceText.charAt(this._pos) : null; + return this._sourceText.charAt(this._pos) + ? this._sourceText.charAt(this._pos) + : null; } next(): string { @@ -102,7 +103,7 @@ export default class MultilineCharacterStream { switch (typeof pattern) { case 'string': { - const regex = new RegExp(pattern, (caseFold ? 'i' : '')); + const regex = new RegExp(pattern, caseFold ? 'i' : ''); match = regex.test(this._sourceText.substr(this._pos, pattern.length)); token = pattern; break; @@ -118,12 +119,7 @@ export default class MultilineCharacterStream { break; } - if ( - match && ( - typeof pattern === 'string' || - match.index === 0 - ) - ) { + if (match && (typeof pattern === 'string' || match.index === 0)) { if (consume) { this._start = this._pos; this._pos += token.length; @@ -147,7 +143,7 @@ export default class MultilineCharacterStream { const match = this._sourceText.match(/\s*/); let indent = 0; if (match && match.index === 0) { - const whitespaces = match[0]; + const [whitespaces] = match; let pos = 0; while (whitespaces.length > pos) { if (whitespaces.charCodeAt(pos) === 9) { diff --git a/src/shared/__mocks__/watch.js b/src/shared/__mocks__/watch.js index 99d729c..c54f9b3 100755 --- a/src/shared/__mocks__/watch.js +++ b/src/shared/__mocks__/watch.js @@ -6,7 +6,7 @@ export default function watch({ rootPath, files, onChange }: any) { rootPath, files: glob .sync(files, { cwd: rootPath }) - .map(_name => ({ name: _name, exists: true })), + .map((_name) => ({ name: _name, exists: true })), trigger() { if (!request.pending) { @@ -23,7 +23,7 @@ export default function watch({ rootPath, files, onChange }: any) { setImmediate(() => { request.trigger(); }); - return { end: () => {} }; + return { end: () => {} }; // eslint-disable-line no-empty-function } watch.__requests = []; diff --git a/src/shared/createValidate.js b/src/shared/createValidate.js index cb0ec34..cc1174a 100644 --- a/src/shared/createValidate.js +++ b/src/shared/createValidate.js @@ -24,7 +24,7 @@ export default function createValidate( }; // remove all 'off' rules - const rules = base.rules.filter(rule => config[rule.name] !== 'off'); + const rules = base.rules.filter((rule) => config[rule.name] !== 'off'); return { config, rules }; }); @@ -54,7 +54,7 @@ export default function createValidate( const _schema: any = schema; const typeInfo = new TypeInfo(_schema); const context = new ValidationContext(_schema, ast, typeInfo); - const visitors = rules.map(rule => rule(makeRuleContext(context, rule, config))); + const visitors = rules.map((rule) => rule(makeRuleContext(context, rule, config))); visit(ast, visitWithTypeInfo(typeInfo, visitInParallel(visitors))); return (context.getErrors(): any); }; diff --git a/src/shared/debug.js b/src/shared/debug.js index 06c382f..8af7f53 100644 --- a/src/shared/debug.js +++ b/src/shared/debug.js @@ -1,5 +1,5 @@ /* @flow */ -const noop = () => {}; +const noop = () => {}; // eslint-disable-line no-empty-function const debug = new Proxy(console, { _isEnabled: false, get(target, key) { diff --git a/src/shared/getTokenAtPosition.js b/src/shared/getTokenAtPosition.js index ec23c62..68871de 100644 --- a/src/shared/getTokenAtPosition.js +++ b/src/shared/getTokenAtPosition.js @@ -22,7 +22,7 @@ export default function getTokenAtPosition( const offset = toOffset(sourceText, position); const stream = new MultilineCharacterStream(sourceText); - let style; + let style = ''; whileSafe({ condition: () => stream.getCurrentPosition() < offset, diff --git a/src/shared/suggestionList.js b/src/shared/suggestionList.js deleted file mode 100755 index 6d0b7ea..0000000 --- a/src/shared/suggestionList.js +++ /dev/null @@ -1,22 +0,0 @@ -/* @ flow */ -import leven from 'leven'; - -export default function suggestionList( - input: string, - options: Array, -): Array { - const optionsByDistance = Object.create(null); - const oLength = options.length; - const inputThreshold = input.length / 2; - for (let i = 0; i < oLength; i += 1) { - const distance = leven(input, options[i]); - const threshold = Math.max(inputThreshold, options[i].length / 2, 1); - if (distance <= threshold) { - optionsByDistance[options[i]] = distance; - } - } - return Object.keys(optionsByDistance).sort( - (a, b) => optionsByDistance[a] - optionsByDistance[b], - ); -} - diff --git a/src/shared/types.js b/src/shared/types.js index 3d1d598..f8a06ea 100755 --- a/src/shared/types.js +++ b/src/shared/types.js @@ -2,7 +2,7 @@ export type ParsedFilesMap = Map; export type WatchFile = $Exact<{ name: string, - exists: bool, + exists: boolean, }>; export type AbsoluteFilePath = string; @@ -61,5 +61,5 @@ export type ValidationRulesPackage = { rules: Array, config: { [ruleName: string]: 'off' | 'warn' | 'error', - } + }, }; diff --git a/src/shared/watch.js b/src/shared/watch.js index 687c0d9..41f3ec8 100755 --- a/src/shared/watch.js +++ b/src/shared/watch.js @@ -1,10 +1,7 @@ /* @flow */ import watchman from 'fb-watchman'; import { type WatchFile } from './types'; -import { - type FileMatchConfig, - type Globs, -} from '../config/GQLConfig'; +import { type FileMatchConfig, type Globs } from '../config/GQLConfig'; const globToMatchExpr = (glob: Globs): Array => { if (typeof glob === 'string') { @@ -16,10 +13,7 @@ const globToMatchExpr = (glob: Globs): Array => { } // array - return [ - 'anyof', - ...glob.map(g => (['match', g, 'wholename'])), - ]; + return ['anyof', ...glob.map((g) => ['match', g, 'wholename'])]; }; export function toMatchExpression(match: FileMatchConfig) { @@ -33,11 +27,7 @@ export function toMatchExpression(match: FileMatchConfig) { const ignoreMatchExpr = match.ignore ? globToMatchExpr(match.ignore) : null; if (ignoreMatchExpr) { - return [ - 'allof', - matchExpr, - ['not', ignoreMatchExpr], - ]; + return ['allof', matchExpr, ['not', ignoreMatchExpr]]; } return matchExpr; @@ -54,48 +44,60 @@ export default function watch(options: WatchOptions) { const { rootPath, name, files, onChange } = options; // console.log(`Launching watch server for ${rootPath}`); const client = new watchman.Client(); - client.capabilityCheck({ optional: [], required: ['relative_root'] }, (error) => { - if (error) { - console.error(error); - client.end(); - return; - } - - client.command(['watch-project', rootPath], (err, { watch: _watch, relative_path: relativePath, warning }) => { - if (err) { - console.error('Error initiating watch:', err); + client.capabilityCheck( + { optional: [], required: ['relative_root'] }, + (error) => { + if (error) { + console.error(error); + client.end(); return; } - if (warning) { - console.log('warning: ', warning); - } - - const sub = { - expression: toMatchExpression(files), - fields: ['name', 'exists', 'type'], - relative_root: relativePath, - }; - - // console.log(`Watch established on ${_watch} ${files}`); - - const gqlFilesWatchSubscription = name; - client.command(['subscribe', _watch, gqlFilesWatchSubscription, sub], (subscribeError, resp) => { - if (subscribeError) { - console.error('failed to subscribe: ', subscribeError); - return; - } - - // $FlowDisableNextLine - console.log(`[Watch established (${resp.subscribe})] \n\tbasePath: ${_watch} \n\tRelativePath: ${relativePath} \n\tFiles: ${JSON.stringify(files, 2, 2)}`); - }); - - client.on('subscription', (resp) => { - if (resp.subscription !== gqlFilesWatchSubscription) { return; } - onChange(resp.files); - }); - }); - }); + client.command( + ['watch-project', rootPath], + (err, { watch: _watch, relative_path: relativePath, warning }) => { + if (err) { + console.error('Error initiating watch:', err); + return; + } + + if (warning) { + console.log('warning: ', warning); + } + + const sub = { + expression: toMatchExpression(files), + fields: ['name', 'exists', 'type'], + relative_root: relativePath, // eslint-disable-line camelcase + }; + + // console.log(`Watch established on ${_watch} ${files}`); + + const gqlFilesWatchSubscription = name; + client.command( + ['subscribe', _watch, gqlFilesWatchSubscription, sub], + (subscribeError, resp) => { + if (subscribeError) { + console.error('failed to subscribe: ', subscribeError); + return; + } + + // $FlowDisableNextLine + console.log( + `[Watch established (${resp.subscribe})] \n\tbasePath: ${_watch} \n\tRelativePath: ${relativePath} \n\tFiles: ${JSON.stringify(files, 2, 2)}`, + ); + }, + ); + + client.on('subscription', (resp) => { + if (resp.subscription !== gqlFilesWatchSubscription) { + return; + } + onChange(resp.files); + }); + }, + ); + }, + ); return client; } - diff --git a/src/tools/__tests__/generate.test.js b/src/tools/__tests__/generate.test.js index 2749372..0a68209 100644 --- a/src/tools/__tests__/generate.test.js +++ b/src/tools/__tests__/generate.test.js @@ -16,6 +16,10 @@ test('generate: schemaJSON', (done) => { { type: 'schemaJSON' }, ], callback: (err, content) => { + if (err) { + done.fail(err); + return; + } expect(content).toMatchSnapshot(); done(); }, diff --git a/src/tools/generate/index.js b/src/tools/generate/index.js index ef7655b..ea27c96 100644 --- a/src/tools/generate/index.js +++ b/src/tools/generate/index.js @@ -50,7 +50,7 @@ function generate(params: Params) { onInit: async () => { try { const schema = schemaBuilder.getGraphQLSchema(); - const targetContent = await Promise.all(params.targets.map(target => ( + const targetContent = await Promise.all(params.targets.map((target) => ( generateFile(schema, target) ))); if (params.callback) { params.callback(null, targetContent); } diff --git a/yarn.lock b/yarn.lock index 5c2a77d..8079681 100644 --- a/yarn.lock +++ b/yarn.lock @@ -86,7 +86,7 @@ ansi-escapes@^1.1.0, ansi-escapes@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" -ansi-regex@^2.0.0: +ansi-regex@^2.0.0, ansi-regex@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -427,13 +427,13 @@ babel-helpers@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-jest@20.0.0, babel-jest@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-20.0.0.tgz#05ae371102ee8e30c9d61ffdf3f61c738a87741f" +babel-jest@20.0.1, babel-jest@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-20.0.1.tgz#9cbe9a15bbe3f1ca1b727dc8e45a4161771d3655" dependencies: babel-core "^6.0.0" babel-plugin-istanbul "^4.0.0" - babel-preset-jest "^20.0.0" + babel-preset-jest "^20.0.1" babel-messages@^6.22.0, babel-messages@^6.23.0: version "6.23.0" @@ -466,9 +466,9 @@ babel-plugin-istanbul@^4.0.0: istanbul-lib-instrument "^1.4.2" test-exclude "^4.0.0" -babel-plugin-jest-hoist@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.0.tgz#d2afe94fa6aea3b8bfa5d61d8028f633c898d86d" +babel-plugin-jest-hoist@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.1.tgz#1b9cc322cff704d3812d1bca8dccd12205eedfd5" babel-plugin-react-intl@2.3.1: version "2.3.1" @@ -811,11 +811,11 @@ babel-preset-es2015@6.22.0: babel-plugin-transform-es2015-unicode-regex "^6.22.0" babel-plugin-transform-regenerator "^6.22.0" -babel-preset-jest@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-20.0.0.tgz#16b992c9351c2525e87a19fd36ba14e47df51bad" +babel-preset-jest@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-20.0.1.tgz#8a9e23ce8a0f0c49835de53ed73ecf75dd6daa2e" dependencies: - babel-plugin-jest-hoist "^20.0.0" + babel-plugin-jest-hoist "^20.0.1" babel-preset-playlyfe@1.2.0: version "1.2.0" @@ -1136,9 +1136,9 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" -codecov@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/codecov/-/codecov-2.1.0.tgz#25f48f9e9aa7473b61c5a9a934d595420a71cade" +codecov@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/codecov/-/codecov-2.2.0.tgz#2d06817ceb8891eca6368836d4fb6bf6cc04ffd1" dependencies: argv "0.0.2" request "2.79.0" @@ -1254,9 +1254,9 @@ core-util-is@^1.0.1, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -cross-env@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-4.0.0.tgz#16083862d08275a4628b0b243b121bedaa55dd80" +cross-env@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.0.0.tgz#565ccae4d09676441a5087f406fe7661a29c931b" dependencies: cross-spawn "^5.1.0" is-windows "^1.0.0" @@ -1548,9 +1548,35 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-airbnb-base@11.1.3: - version "11.1.3" - resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.1.3.tgz#0e8db71514fa36b977fbcf977c01edcf863e0cf0" +eslint-plugin-babel@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-4.1.1.tgz#ef285c87039b67beb3bbd227f5b0eed4fb376b87" + +eslint-plugin-flowtype@2.33.0: + version "2.33.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.33.0.tgz#b2783814ed2ddcf729953b8f65ff73c90cabee4b" + dependencies: + lodash "^4.15.0" + +eslint-plugin-playlyfe@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-playlyfe/-/eslint-plugin-playlyfe-3.0.0.tgz#96f5dff1adba54e5435828ca164515eec53af91c" + dependencies: + babel-eslint "7.2.3" + eslint "3.19.0" + eslint-plugin-babel "4.1.1" + eslint-plugin-flowtype "2.33.0" + eslint-plugin-react "7.0.1" + invariant "2.2.2" + lodash "4.17.4" + +eslint-plugin-react@7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.0.1.tgz#e78107e1e559c6e2b17786bb67c2e2a010ad0d2f" + dependencies: + doctrine "^2.0.0" + has "^1.0.1" + jsx-ast-utils "^1.3.4" eslint@3.19.0: version "3.19.0" @@ -1808,9 +1834,9 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-bin@0.45.0: - version "0.45.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.45.0.tgz#009dd0f577a3f665c74ca8be827ae8c2dd8fd6b5" +flow-bin@0.46.0: + version "0.46.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.46.0.tgz#06ad7fe19dddb1042264438064a2a32fee12b872" flow-config-parser@^0.3.0: version "0.3.0" @@ -1945,6 +1971,10 @@ fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: mkdirp ">=0.5 0" rimraf "2" +function-bind@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" + gauge@~1.2.0: version "1.2.7" resolved "https://registry.yarnpkg.com/gauge/-/gauge-1.2.7.tgz#e9cec5483d3d4ee0ef44b60a7d99e4935e136d93" @@ -2103,40 +2133,40 @@ graceful-fs@~3.0.2: version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" -graphql-language-service-config@0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/graphql-language-service-config/-/graphql-language-service-config-0.0.10.tgz#356595fc424f9597a865ce2108c2ffb0565c02c2" +graphql-language-service-config@0.0.11: + version "0.0.11" + resolved "https://registry.yarnpkg.com/graphql-language-service-config/-/graphql-language-service-config-0.0.11.tgz#edf593ee7d0b6d8f9cbc8fe5d958b8607c75cea4" dependencies: - graphql-language-service-types "0.0.15" + graphql-language-service-types "0.0.16" -graphql-language-service-interface@0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-0.0.10.tgz#925e8205fa45ffa0638639dd6978c278cad95e60" +graphql-language-service-interface@0.0.11: + version "0.0.11" + resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-0.0.11.tgz#d84d9b5c6044049187e5fb351cfe1ebdcdf04520" dependencies: graphql "^0.9.6" - graphql-language-service-config "0.0.10" - graphql-language-service-parser "0.0.9" - graphql-language-service-types "0.0.15" - graphql-language-service-utils "0.0.9" + graphql-language-service-config "0.0.11" + graphql-language-service-parser "0.0.10" + graphql-language-service-types "0.0.16" + graphql-language-service-utils "0.0.10" -graphql-language-service-parser@0.0.9: - version "0.0.9" - resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-0.0.9.tgz#522b25554076b46fce8a3e71017b5c6cdb24a676" +graphql-language-service-parser@0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-0.0.10.tgz#ed74f77ba0f135d06d7e767874f872c3f12cc71f" dependencies: - graphql-language-service-types "0.0.15" + graphql-language-service-types "0.0.16" -graphql-language-service-types@0.0.15: - version "0.0.15" - resolved "https://registry.yarnpkg.com/graphql-language-service-types/-/graphql-language-service-types-0.0.15.tgz#3f1446beaa78146b78f49c7d7047293301a58393" +graphql-language-service-types@0.0.16: + version "0.0.16" + resolved "https://registry.yarnpkg.com/graphql-language-service-types/-/graphql-language-service-types-0.0.16.tgz#8bf9061873cd7e9c6923d51536f418b966a91a85" dependencies: graphql "^0.9.6" -graphql-language-service-utils@0.0.9: - version "0.0.9" - resolved "https://registry.yarnpkg.com/graphql-language-service-utils/-/graphql-language-service-utils-0.0.9.tgz#de1b9fdadfa1d59a3c33a96b534b18efea84d0ad" +graphql-language-service-utils@0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/graphql-language-service-utils/-/graphql-language-service-utils-0.0.10.tgz#9cc1df69f8e4382088e790da96e45b07fda9a5f9" dependencies: graphql "^0.9.6" - graphql-language-service-types "0.0.15" + graphql-language-service-types "0.0.16" graphql@0.9.6, graphql@^0.9.5, graphql@^0.9.6: version "0.9.6" @@ -2181,6 +2211,12 @@ has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" +has@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + hawk@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" @@ -2606,13 +2642,13 @@ iterall@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.1.tgz#f7f0af11e9a04ec6426260f5019d9fcca4d50214" -jest-changed-files@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-20.0.0.tgz#2ad82870a815b40ce3f4bf4555581d387b21022c" +jest-changed-files@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-20.0.1.tgz#ba9bd42c3fddb1b7c4ae40065199b44a2335e152" -jest-cli@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-20.0.0.tgz#72664e0723bd099a0bade5bd4bf960fd54876069" +jest-cli@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-20.0.1.tgz#86ca0bc2e47215ad8e7dc85455c0210f86648502" dependencies: ansi-escapes "^1.4.0" callsites "^2.0.0" @@ -2623,18 +2659,18 @@ jest-cli@^20.0.0: istanbul-lib-coverage "^1.0.1" istanbul-lib-instrument "^1.4.2" istanbul-lib-source-maps "^1.1.0" - jest-changed-files "^20.0.0" - jest-config "^20.0.0" - jest-docblock "^20.0.0" - jest-environment-jsdom "^20.0.0" - jest-haste-map "^20.0.0" - jest-jasmine2 "^20.0.0" - jest-message-util "^20.0.0" - jest-regex-util "^20.0.0" - jest-resolve-dependencies "^20.0.0" - jest-runtime "^20.0.0" - jest-snapshot "^20.0.0" - jest-util "^20.0.0" + jest-changed-files "^20.0.1" + jest-config "^20.0.1" + jest-docblock "^20.0.1" + jest-environment-jsdom "^20.0.1" + jest-haste-map "^20.0.1" + jest-jasmine2 "^20.0.1" + jest-message-util "^20.0.1" + jest-regex-util "^20.0.1" + jest-resolve-dependencies "^20.0.1" + jest-runtime "^20.0.1" + jest-snapshot "^20.0.1" + jest-util "^20.0.1" micromatch "^2.3.11" node-notifier "^5.0.2" pify "^2.3.0" @@ -2645,176 +2681,177 @@ jest-cli@^20.0.0: worker-farm "^1.3.1" yargs "^7.0.2" -jest-config@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-20.0.0.tgz#295fe937a377f79a8eea240ad29546bf43acbbec" +jest-config@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-20.0.1.tgz#c6934f585c3e1775c96133efb302f986c3909ad8" dependencies: chalk "^1.1.3" glob "^7.1.1" - jest-environment-jsdom "^20.0.0" - jest-environment-node "^20.0.0" - jest-jasmine2 "^20.0.0" - jest-regex-util "^20.0.0" - jest-resolve "^20.0.0" - jest-validate "^20.0.0" - pretty-format "^20.0.0" - -jest-diff@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-20.0.0.tgz#d6e9190b57e0333c6706ef28d62b1cb23042d7eb" + jest-environment-jsdom "^20.0.1" + jest-environment-node "^20.0.1" + jest-jasmine2 "^20.0.1" + jest-matcher-utils "^20.0.1" + jest-regex-util "^20.0.1" + jest-resolve "^20.0.1" + jest-validate "^20.0.1" + pretty-format "^20.0.1" + +jest-diff@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-20.0.1.tgz#2567c80c324243328321386f8871a28ec9d350ac" dependencies: chalk "^1.1.3" diff "^3.2.0" - jest-matcher-utils "^20.0.0" - pretty-format "^20.0.0" + jest-matcher-utils "^20.0.1" + pretty-format "^20.0.1" -jest-docblock@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.0.tgz#5b647c4af36f52dae74df1949a8cb418d146ad3a" +jest-docblock@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.1.tgz#055e0bbcb76798198479901f92d2733bf619f854" -jest-environment-jsdom@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-20.0.0.tgz#a688499d817e33cdea6400c502d8d5f4aa01c808" +jest-environment-jsdom@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-20.0.1.tgz#2d29f81368987d387c70ce4f500c6aa560f9b4f7" dependencies: - jest-mock "^20.0.0" - jest-util "^20.0.0" + jest-mock "^20.0.1" + jest-util "^20.0.1" jsdom "^9.12.0" -jest-environment-node@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-20.0.0.tgz#7016d8d1270cbc1ed71a10f242c78324297e1db8" +jest-environment-node@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-20.0.1.tgz#75ab5358072ee1efebc54f43474357d7b3d674c7" dependencies: - jest-mock "^20.0.0" - jest-util "^20.0.0" + jest-mock "^20.0.1" + jest-util "^20.0.1" -jest-haste-map@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.0.0.tgz#3b8d9255dfe2a6a96e516fe71dafd415e1b5d65f" +jest-haste-map@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.0.1.tgz#e6ba4db99ab512e7c081a5b0a0af731d0e193d56" dependencies: fb-watchman "^2.0.0" graceful-fs "^4.1.11" - jest-docblock "^20.0.0" + jest-docblock "^20.0.1" micromatch "^2.3.11" sane "~1.6.0" worker-farm "^1.3.1" -jest-jasmine2@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-20.0.0.tgz#2a0aba92ed36ec132901cfc2a552fd7cee6fde3d" +jest-jasmine2@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-20.0.1.tgz#675772b1fd32ad74e92e8ae8282f8ea71d1de168" dependencies: chalk "^1.1.3" graceful-fs "^4.1.11" - jest-diff "^20.0.0" - jest-matcher-utils "^20.0.0" - jest-matchers "^20.0.0" - jest-message-util "^20.0.0" - jest-snapshot "^20.0.0" + jest-diff "^20.0.1" + jest-matcher-utils "^20.0.1" + jest-matchers "^20.0.1" + jest-message-util "^20.0.1" + jest-snapshot "^20.0.1" once "^1.4.0" p-map "^1.1.1" -jest-matcher-utils@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-20.0.0.tgz#2c5d9dd11670c5418ffc78baecf9094db9e91e09" +jest-matcher-utils@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-20.0.1.tgz#31aef67f59535af3c2271a3a3685db604dbd1622" dependencies: chalk "^1.1.3" - pretty-format "^20.0.0" + pretty-format "^20.0.1" -jest-matchers@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-matchers/-/jest-matchers-20.0.0.tgz#55498637bbb58f164d97c73610fb8d016dfac770" +jest-matchers@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-matchers/-/jest-matchers-20.0.1.tgz#053b7654ce60129268f39992886e987a5201bb90" dependencies: - jest-diff "^20.0.0" - jest-matcher-utils "^20.0.0" - jest-message-util "^20.0.0" - jest-regex-util "^20.0.0" + jest-diff "^20.0.1" + jest-matcher-utils "^20.0.1" + jest-message-util "^20.0.1" + jest-regex-util "^20.0.1" -jest-message-util@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-20.0.0.tgz#060bac1980bd5e11134e8e1c19c94863d937c727" +jest-message-util@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-20.0.1.tgz#ac21cb055a6a5786b7f127ac7e705df5ffb1c335" dependencies: chalk "^1.1.3" micromatch "^2.3.11" slash "^1.0.0" -jest-mock@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-20.0.0.tgz#3c54b94fe502ed57f2e602fab22ab196a7aa4b95" +jest-mock@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-20.0.1.tgz#f4cca2e87e441b66fabe4ead6a6d61773ec0773a" -jest-regex-util@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-20.0.0.tgz#7f6051e9d00fdcccca52bade50aabdd9919bcfd2" +jest-regex-util@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-20.0.1.tgz#ecbcca8fbe4e217bca7f6f42a9b831d051224dc4" -jest-resolve-dependencies@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.0.tgz#616c6976c52e49d13e6420b1bcc8f380e701408f" +jest-resolve-dependencies@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.1.tgz#38fc012191775b0b277fabebb37aa8282e26846f" dependencies: - jest-regex-util "^20.0.0" + jest-regex-util "^20.0.1" -jest-resolve@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-20.0.0.tgz#f9bfdfa31109aee2decfc3a07c2c354608cc5e1d" +jest-resolve@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-20.0.1.tgz#cace553663f25c703dc977a4ce176e29eda92772" dependencies: browser-resolve "^1.11.2" is-builtin-module "^1.0.0" resolve "^1.3.2" -jest-runtime@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-20.0.0.tgz#4c78c08573ffaeba9b8ceb096f705b75d5fb54a1" +jest-runtime@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-20.0.1.tgz#384f9298b8e8a177870c6d9ad0023db10ddcaedc" dependencies: babel-core "^6.0.0" - babel-jest "^20.0.0" + babel-jest "^20.0.1" babel-plugin-istanbul "^4.0.0" chalk "^1.1.3" convert-source-map "^1.4.0" graceful-fs "^4.1.11" - jest-config "^20.0.0" - jest-haste-map "^20.0.0" - jest-regex-util "^20.0.0" - jest-resolve "^20.0.0" - jest-util "^20.0.0" + jest-config "^20.0.1" + jest-haste-map "^20.0.1" + jest-regex-util "^20.0.1" + jest-resolve "^20.0.1" + jest-util "^20.0.1" json-stable-stringify "^1.0.1" micromatch "^2.3.11" strip-bom "3.0.0" yargs "^7.0.2" -jest-snapshot@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-20.0.0.tgz#fbe51d94ed1c6cd23808bb7ef82e58ca12a0ccf7" +jest-snapshot@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-20.0.1.tgz#3704c599705042f20ec7c95ba76a4524c744dfac" dependencies: chalk "^1.1.3" - jest-diff "^20.0.0" - jest-matcher-utils "^20.0.0" - jest-util "^20.0.0" + jest-diff "^20.0.1" + jest-matcher-utils "^20.0.1" + jest-util "^20.0.1" natural-compare "^1.4.0" - pretty-format "^20.0.0" + pretty-format "^20.0.1" -jest-util@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-20.0.0.tgz#5421322f196e884e962bc8b8bac4b009733caed9" +jest-util@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-20.0.1.tgz#a3e7afb67110b2c3ac77b82e9a51ca57f4ff72a1" dependencies: chalk "^1.1.3" graceful-fs "^4.1.11" - jest-message-util "^20.0.0" - jest-mock "^20.0.0" - jest-validate "^20.0.0" + jest-message-util "^20.0.1" + jest-mock "^20.0.1" + jest-validate "^20.0.1" leven "^2.1.0" mkdirp "^0.5.1" -jest-validate@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-20.0.0.tgz#c0832e8210190b6d5b39a46b8df536083131a7d7" +jest-validate@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-20.0.1.tgz#a236c29e3c29e9b92a1e5da211a732f0238da928" dependencies: chalk "^1.1.3" - jest-matcher-utils "^20.0.0" + jest-matcher-utils "^20.0.1" leven "^2.1.0" - pretty-format "^20.0.0" + pretty-format "^20.0.1" -jest@20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-20.0.0.tgz#58cf6abf328f2a2e3c4203890131cbe89d3b0769" +jest@20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/jest/-/jest-20.0.1.tgz#4e268159ccc3b659966939de817c75bfe9e0157d" dependencies: - jest-cli "^20.0.0" + jest-cli "^20.0.1" jodid25519@^1.0.0: version "1.0.2" @@ -2919,6 +2956,10 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.3.6" +jsx-ast-utils@^1.3.4: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1" + keymirror@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/keymirror/-/keymirror-0.1.1.tgz#918889ea13f8d0a42e7c557250eee713adc95c35" @@ -3056,7 +3097,7 @@ lodash@4.17.2: version "4.17.2" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42" -lodash@4.17.4, lodash@^4.0.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.2.0, lodash@^4.3.0: +lodash@4.17.4, lodash@^4.0.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -3628,10 +3669,11 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -pretty-format@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.0.tgz#bd100f330e707e4f49fef3f234d6e915242a6e7e" +pretty-format@^20.0.1: + version "20.0.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.1.tgz#ba95329771907c189643dd251e244061ff642350" dependencies: + ansi-regex "^2.1.1" ansi-styles "^3.0.0" private@^0.1.6: