diff --git a/.flowconfig b/.flowconfig index b3be8830312..0d4a2f081f7 100644 --- a/.flowconfig +++ b/.flowconfig @@ -2,9 +2,37 @@ .*/coverage/.* .*/resources/.* .*/node_modules/.* +!/node_modules/chai +!/node_modules/mocha +!/node_modules/graphql +!/node_modules/iterall +!/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 diff --git a/.gitignore b/.gitignore index 87596e74645..b025b17e81d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ coverage/ /utils /variables /results +/__tests__ diff --git a/package.json b/package.json index e594bfc6753..8c923f2dc84 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": { @@ -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", diff --git a/src/info.js b/src/info.js index ffe862d9153..53576c10c76 100644 --- a/src/info.js +++ b/src/info.js @@ -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)); diff --git a/src/utils/SchemaReference.js b/src/utils/SchemaReference.js index 67c7bb5fe12..1c2a91c9e91 100644 --- a/src/utils/SchemaReference.js +++ b/src/utils/SchemaReference.js @@ -14,6 +14,7 @@ import type { GraphQLArgument, GraphQLDirective, GraphQLEnumValue, + GraphQLEnumType, GraphQLField, GraphQLNamedType, } from 'graphql'; @@ -27,7 +28,7 @@ export type SchemaReference = export type FieldReference = { kind: 'Field', - field: GraphQLField, + field: GraphQLField, type: ?GraphQLNamedType, }; @@ -39,7 +40,7 @@ export type DirectiveReference = { export type ArgumentReference = { kind: 'Argument', argument: GraphQLArgument, - field?: GraphQLField, + field?: GraphQLField, type?: ?GraphQLNamedType, directive?: GraphQLDirective, }; @@ -93,6 +94,7 @@ export function getEnumValueReference(typeInfo: any): EnumValueReference { return { kind: 'EnumValue', value: typeInfo.enumValue, + // $FlowFixMe type: getNamedType(typeInfo.inputType), }; } diff --git a/yarn.lock b/yarn.lock index ce65c70700b..4432c53f222 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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" @@ -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"