Skip to content

Commit

Permalink
Tweak flowconfig and flow typings for flow-bin 0.100
Browse files Browse the repository at this point in the history
- move documentation
- add license
  • Loading branch information
acao committed Jun 6, 2019
1 parent a64753f commit 7d31103
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ packages/graphiql/test/vendor
!.eslintrc.js
**/node_modules/**
**/flow-typed/**
**/dist/**
17 changes: 16 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,34 @@
.*/coverage/.*
.*/dist/.*
.*/resources/.*
.*/node_modules/.*
.*/node_modules/conventional-changelog-core/*
.*/node_modules/graphql/error/GraphQLError.js.flow
!<PROJECT_ROOT>/node_modules/chai
!<PROJECT_ROOT>/node_modules/mocha
!<PROJECT_ROOT>/node_modules/graphql
!<PROJECT_ROOT>/node_modules/iterall
!<PROJECT_ROOT>/node_modules/codemirror
!<PROJECT_ROOT>/node_modules/codemirror-graphql
!<PROJECT_ROOT>/node_modules/graphql-language-service-interface
!<PROJECT_ROOT>/node_modules/graphql-language-service-server
!<PROJECT_ROOT>/node_modules/graphql-language-service-parser
!<PROJECT_ROOT>/node_modules/graphql-language-service-types
!<PROJECT_ROOT>/node_modules/graphql-language-service-utils
!<PROJECT_ROOT>/node_modules/babylon
!<PROJECT_ROOT>/node_modules/glob
!<PROJECT_ROOT>/node_modules/vscode-languageserver
!<PROJECT_ROOT>/node_modules/vscode-jsonrpc
!<PROJECT_ROOT>/node_modules/vscode-languageserver-types
!<PROJECT_ROOT>/node_modules/nullthrows
!<PROJECT_ROOT>/node_modules/fb-watchman
!<PROJECT_ROOT>/node_modules/yargs

[include]

[libs]

[options]
module.name_mapper='^graphql-language-service-\([^/]+\)$' -> '<PROJECT_ROOT>/packages/\1/src/index.js'
module.name_mapper='^graphql-language-\([^/]+\)$' -> '<PROJECT_ROOT>/packages/graphql-language-\1/src/index.js'
module.name_mapper='graphiql' -> '<PROJECT_ROOT>/packages/graphiql/src/index.js'
module.name_mapper='codemirror-graphql' -> '<PROJECT_ROOT>/packages/codemirror-graphql/src/index.js'
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
},
"scripts": {
"build": "lerna run build",
"test": "yarn run lint && yarn run build && yarn run testonly",
"test": "yarn run lint && yarn run check && yarn run build && yarn run testonly",
"testonly": "mocha $npm_package_options_mocha && lerna run test --scope graphiql",
"t": "yarn run testonly",
"lint": "eslint packages/**/src || (printf '\\033[33mTry: \\033[7m yarn run lint -- --fix \\033[0m\\n' && exit 1)",
"lint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
"check": "flow check --show-all-errors",
"propublish": "node resources/prepublish.js",
"prepublish": "node resources/prepublish.js",
"pretty": "node resources/pretty.js",
"pretty-check": "node resources/pretty.js --check"
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function getFieldDef(
return TypeNameMetaFieldDef;
}
if (type.getFields && typeof type.getFields === 'function') {
// $FlowFixMe
return (type.getFields()[fieldName]: any);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ function getSuggestionsForFieldNames(
const parentType = typeInfo.parentType;
const fields =
parentType.getFields instanceof Function
// $FlowFixMe
? objectValues(parentType.getFields())
: [];
if (isAbstractType(parentType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export class MessageProcessor {
token: CancellationToken,
): Promise<CompletionList | Array<CompletionItem>> {
if (!this._isInitialized) {
// $FlowFixMe
return [];
}

Expand Down Expand Up @@ -391,6 +392,7 @@ export class MessageProcessor {

// If there is no GraphQL query in this file, return an empty result.
if (!found) {
// $FlowFixMe
return [];
}

Expand Down
6 changes: 5 additions & 1 deletion packages/graphql-language-service/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ function _getDiagnostics(
function _getOutline(queryText: string): EXIT_CODE {
try {
const outline = getOutline(queryText);
process.stdout.write(JSON.stringify(outline, null, 2));
if (outline) {
process.stdout.write(JSON.stringify(outline, null, 2));
} else {
throw Error('Error parsing or no outline tree found');
}
} catch (error) {
process.stderr.write(error);
return GRAPHQL_FAILURE_CODE;
Expand Down
9 changes: 1 addition & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8724,14 +8724,7 @@ resolve@1.1.7:
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=

resolve@^1.1.4, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.3.2, resolve@^1.4.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232"
integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==
dependencies:
path-parse "^1.0.6"

resolve@^1.8.1:
resolve@^1.1.4, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.8.1:
version "1.11.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e"
integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==
Expand Down

0 comments on commit 7d31103

Please sign in to comment.