Skip to content

Commit

Permalink
Merge pull request graphql#262 from acao/upgrade-flow
Browse files Browse the repository at this point in the history
upgrade flow, fix typings
  • Loading branch information
acao committed May 31, 2019
2 parents f62040b + f4d7fa1 commit f708cd6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 13 deletions.
28 changes: 28 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,37 @@
.*/coverage/.*
.*/resources/.*
.*/node_modules/.*
!<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

[include]

[libs]

[options]
include_warnings=true
module.use_strict=true

[lints]
sketchy-null-bool=off
sketchy-null-string=off
sketchy-null-number=error
sketchy-null-mixed=error
sketchy-number=error
untyped-type-import=error
nonstrict-import=off
untyped-import=off
unclear-type=off
deprecated-type=off
deprecated-utility=error
dynamic-export=off
unsafe-getters-setters=error
inexact-spread=error
unnecessary-optional-chain=error
unnecessary-invariant=off

[version]
^0.98.0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ coverage/
/utils
/variables
/results
/__tests__
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"mocha_tdd": "--full-trace --watch --require resources/mocha-bootload src/**/__tests__/**/*-test.js"
},
"scripts": {
"test": "npm run lint && npm run pretty-check && npm run testonly",
"test": "yarn run check && yarn run lint && yarn run pretty-check && yarn run testonly",
"testonly": "babel-node ./node_modules/.bin/_mocha $npm_package_options_mocha",
"testwatch": "babel-node --inspect ./node_modules/.bin/_mocha $npm_package_options_mocha_tdd",
"lint": "eslint src",
Expand All @@ -42,7 +42,7 @@
"watch": "babel --optional runtime resources/watch.js | node",
"pretty": "node resources/pretty.js",
"pretty-check": "node resources/pretty.js --check",
"preversion": ". ./resources/checkgit.sh && npm test",
"preversion": ". ./resources/checkgit.sh && yarn test",
"prepublish": ". ./resources/prepublish.sh"
},
"peerDependencies": {
Expand All @@ -67,7 +67,7 @@
"eslint": "^5.16.0",
"eslint-plugin-babel": "5.3.0",
"eslint-plugin-flowtype": "3.9.1",
"flow-bin": "^0.56.0",
"flow-bin": "^0.98.1",
"graphql": "^14.0.2",
"jsdom": "^11.2.0",
"mocha": "3.5.0",
Expand Down
10 changes: 7 additions & 3 deletions src/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,21 @@ function renderDeprecation(into, options, def) {
}
}

function text(into, content, className, options, ref) {
function text(into, content, className, options = {onClick: null}, ref) {
if (className) {
const onClick = options.onClick;
const node = document.createElement(onClick ? 'a' : 'span');
let node;
if (onClick) {
node = document.createElement('a');

// Providing a href forces proper a tag behavior, though we don't actually
// want clicking the node to navigate anywhere.
node.href = 'javascript:void 0'; // eslint-disable-line no-script-url
node.addEventListener('click', function(e) {
node.addEventListener('click', function(e: MouseEvent) {
onClick(ref, e);
});
} else {
node = document.createElement('span');
}
node.className = className;
node.appendChild(document.createTextNode(content));
Expand Down
6 changes: 4 additions & 2 deletions src/utils/SchemaReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
GraphQLArgument,
GraphQLDirective,
GraphQLEnumValue,
GraphQLEnumType,
GraphQLField,
GraphQLNamedType,
} from 'graphql';
Expand All @@ -27,7 +28,7 @@ export type SchemaReference =

export type FieldReference = {
kind: 'Field',
field: GraphQLField,
field: GraphQLField<any, any>,
type: ?GraphQLNamedType,
};

Expand All @@ -39,7 +40,7 @@ export type DirectiveReference = {
export type ArgumentReference = {
kind: 'Argument',
argument: GraphQLArgument,
field?: GraphQLField,
field?: GraphQLField<any, any>,
type?: ?GraphQLNamedType,
directive?: GraphQLDirective,
};
Expand Down Expand Up @@ -93,6 +94,7 @@ export function getEnumValueReference(typeInfo: any): EnumValueReference {
return {
kind: 'EnumValue',
value: typeInfo.enumValue,
// $FlowFixMe
type: getNamedType(typeInfo.inputType),
};
}
Expand Down
13 changes: 8 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1704,9 +1704,10 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916"
integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==

flow-bin@^0.56.0:
version "0.56.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.56.0.tgz#ce43092203a344ba9bf63c0cabe95d95145f6cad"
flow-bin@^0.98.1:
version "0.98.1"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.98.1.tgz#a8d781621c91703df69928acc83c9777e2fcbb49"
integrity sha512-y1YzQgbFUX4EG6h2EO8PhyJeS0VxNgER8XsTwU8IXw4KozfneSmGVgw8y3TwAOza7rVhTlHEoli1xNuNW1rhPw==

for-in@^1.0.1, for-in@^1.0.2:
version "1.0.2"
Expand Down Expand Up @@ -1943,8 +1944,9 @@ graphql-request@^1.5.0:
cross-fetch "2.2.2"

graphql@^14.0.2:
version "14.0.2"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.0.2.tgz#7dded337a4c3fd2d075692323384034b357f5650"
version "14.3.1"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.3.1.tgz#b3aa50e61a841ada3c1f9ccda101c483f8e8c807"
integrity sha512-FZm7kAa3FqKdXy8YSSpAoTtyDFMIYSpCDOr+3EqlI1bxmtHu+Vv/I2vrSeT1sBOEnEniX3uo4wFhFdS/8XN6gA==
dependencies:
iterall "^1.2.2"

Expand Down Expand Up @@ -2308,6 +2310,7 @@ isstream@~0.1.2:
iterall@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7"
integrity sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==

js-levenshtein@^1.1.3:
version "1.1.6"
Expand Down

0 comments on commit f708cd6

Please sign in to comment.