From 56dd0fb656fd6c166e59d31c65a3d2b85e532762 Mon Sep 17 00:00:00 2001 From: Charlie Croom Date: Sat, 20 Mar 2021 10:40:43 -0400 Subject: [PATCH] Move flow-typed files into default directory Close #1953 --- .eslintignore | 1 + .flowconfig | 1 - .prettierignore | 1 + flow-typed/npm/create-react-class_v15.x.x.js | 6 ++++++ .../npm/prop-types_v15.x.x.js | 17 ++++++++++------- package.json | 4 ++-- types/create-react-class.js | 6 ------ types/fbjs.js | 14 -------------- yarn.lock | 8 ++++---- 9 files changed, 24 insertions(+), 34 deletions(-) create mode 100644 flow-typed/npm/create-react-class_v15.x.x.js rename types/prop-types.js => flow-typed/npm/prop-types_v15.x.x.js (55%) delete mode 100644 types/create-react-class.js delete mode 100644 types/fbjs.js diff --git a/.eslintignore b/.eslintignore index fc8b2194..a6aaae49 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,6 @@ coverage dist +flow-typed node_modules packages/**/vendor/* packages/examples/.next diff --git a/.flowconfig b/.flowconfig index eaf19a7c..30d7ab18 100644 --- a/.flowconfig +++ b/.flowconfig @@ -12,7 +12,6 @@ [include] [libs] -/types [options] munge_underscores=true diff --git a/.prettierignore b/.prettierignore index fc8b2194..a6aaae49 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,6 @@ coverage dist +flow-typed node_modules packages/**/vendor/* packages/examples/.next diff --git a/flow-typed/npm/create-react-class_v15.x.x.js b/flow-typed/npm/create-react-class_v15.x.x.js new file mode 100644 index 00000000..04d7dc6f --- /dev/null +++ b/flow-typed/npm/create-react-class_v15.x.x.js @@ -0,0 +1,6 @@ +// flow-typed signature: 59a949eac1b23f4800e93fe3c647f055 +// flow-typed version: c6154227d1/create-react-class_v15.x.x/flow_>=v0.104.x + +declare module "create-react-class" { + declare module.exports: React$CreateClass; +} diff --git a/types/prop-types.js b/flow-typed/npm/prop-types_v15.x.x.js similarity index 55% rename from types/prop-types.js rename to flow-typed/npm/prop-types_v15.x.x.js index 409eb570..1c4e25c0 100644 --- a/types/prop-types.js +++ b/flow-typed/npm/prop-types_v15.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 3eaa1f24c7397b78a7481992d2cddcb2 -// flow-typed version: a1a20d4928/prop-types_v15.x.x/flow_>=v0.41.x +// flow-typed signature: c93a723cbeb4d2f95d6a472157f6052f +// flow-typed version: 61b795e5b6/prop-types_v15.x.x/flow_>=v0.104.x type $npm$propTypes$ReactPropsCheckType = ( props: any, @@ -8,25 +8,28 @@ type $npm$propTypes$ReactPropsCheckType = ( href?: string ) => ?Error; +// Copied from: https://github.com/facebook/flow/blob/0938da8d7293d0077fbe95c3a3e0eebadb57b012/lib/react.js#L433-L449 declare module 'prop-types' { declare var array: React$PropType$Primitive>; declare var bool: React$PropType$Primitive; - declare var func: React$PropType$Primitive; + declare var func: React$PropType$Primitive<(...a: Array) => mixed>; declare var number: React$PropType$Primitive; - declare var object: React$PropType$Primitive; + declare var object: React$PropType$Primitive<{ +[string]: mixed, ... }>; declare var string: React$PropType$Primitive; + declare var symbol: React$PropType$Primitive; declare var any: React$PropType$Primitive; declare var arrayOf: React$PropType$ArrayOf; - declare var element: React$PropType$Primitive; /* TODO */ + declare var element: React$PropType$Primitive; + declare var elementType: React$PropType$Primitive; declare var instanceOf: React$PropType$InstanceOf; - declare var node: React$PropType$Primitive; /* TODO */ + declare var node: React$PropType$Primitive; declare var objectOf: React$PropType$ObjectOf; declare var oneOf: React$PropType$OneOf; declare var oneOfType: React$PropType$OneOfType; declare var shape: React$PropType$Shape; declare function checkPropTypes( - propTypes: $Subtype<{ [_: $Keys]: $npm$propTypes$ReactPropsCheckType }>, + propTypes: { [key: $Keys]: $npm$propTypes$ReactPropsCheckType, ... }, values: V, location: string, componentName: string, diff --git a/package.json b/package.json index 669841f6..f62403f7 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "jest": "jest --config ./scripts/jest/config.js", "lint": "yarn lint:report --fix", "lint:report": "eslint packages scripts", - "prerelease": "yarn test && yarn compile && yarn compile:commonjs", + "prerelease": "yarn test && yarn compile", "release": "node ./scripts/release/publish.js", "postrelease": "yarn docs:release && yarn benchmarks:release", "test": "yarn flow && yarn lint:report && yarn jest --runInBand" @@ -47,7 +47,7 @@ "del-cli": "^3.0.1", "eslint": "^7.19.0", "eslint-config-prettier": "^7.2.0", - "eslint-plugin-flowtype": "^5.2.0", + "eslint-plugin-flowtype": "^5.4.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", diff --git a/types/create-react-class.js b/types/create-react-class.js deleted file mode 100644 index 01780570..00000000 --- a/types/create-react-class.js +++ /dev/null @@ -1,6 +0,0 @@ -// flow-typed signature: 121e589c9be7dac408c14a02e88287fa -// flow-typed version: a1a20d4928/create-react-class_v15.x.x/flow_>=v0.41.x - -declare module 'create-react-class' { - declare var exports: React$CreateClass; -} diff --git a/types/fbjs.js b/types/fbjs.js deleted file mode 100644 index c5406e25..00000000 --- a/types/fbjs.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -declare module 'fbjs/lib/invariant' { - declare function exports(condition: any, message: string, ...args: Array): void; -} - -declare module 'fbjs/lib/nullthrows' { - declare function exports(value: ?T): T; -} diff --git a/yarn.lock b/yarn.lock index 2068b0f7..46011ef5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4845,10 +4845,10 @@ eslint-config-prettier@^7.2.0: resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz#f4a4bd2832e810e8cc7c1411ec85b3e85c0c53f9" integrity sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg== -eslint-plugin-flowtype@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-5.2.0.tgz#a4bef5dc18f9b2bdb41569a4ab05d73805a3d261" - integrity sha512-z7ULdTxuhlRJcEe1MVljePXricuPOrsWfScRXFhNzVD5dmTHWjIF57AxD0e7AbEoLSbjSsaA5S+hCg43WvpXJQ== +eslint-plugin-flowtype@^5.4.0: + version "5.4.0" + resolved "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-5.4.0.tgz#a559526e56403cb97b470b524957fc526e2485fe" + integrity sha512-O0s0iTT5UxYuoOpHMLSIO2qZMyvrb9shhk1EM5INNGtJ2CffrfUmsnh6TVsnoT41fkXIEndP630WNovhoO87xQ== dependencies: lodash "^4.17.15" string-natural-compare "^3.0.1"