From 3fa415206d5355eda1d7430d24b2d49c2794aa1e Mon Sep 17 00:00:00 2001 From: Steven Leiva Date: Fri, 8 Apr 2022 08:19:03 -0500 Subject: [PATCH] Add flow to package. There is a purposely malformed `package.json` file in one of the dependencies (for testing purposes). See issue: https://github.com/facebook/flow/issues/2364. --- .flowconfig | 13 +++++++++++++ package.json | 5 ++++- src/index.js | 4 +++- yarn.lock | 29 +++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .flowconfig diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000..30d9f5c --- /dev/null +++ b/.flowconfig @@ -0,0 +1,13 @@ +[ignore] +.*/node_modules/resolve/test/resolver/malformed_package_json/package.json + + +[include] + +[libs] + +[lints] + +[options] + +[strict] diff --git a/package.json b/package.json index cd19044..562d6ab 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ }, "babel": { "presets": [ - "@babel/preset-env" + "@babel/preset-env", + "@babel/preset-flow" ] }, "repository": "git@github.com:freckle/react-hooks.git", @@ -22,6 +23,8 @@ "@babel/cli": "^7.17.6", "@babel/core": "^7.17.9", "@babel/preset-env": "^7.16.11", + "@babel/preset-flow": "^7.16.7", + "flow-bin": "^0.175.1", "jest": "^27.5.1", "watch": "^1.0.2" } diff --git a/src/index.js b/src/index.js index b14b898..8272a65 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ -const helloWord = () => "Hello, World!"; +// @flow + +const helloWord = (): string => "Hello, World!"; export { helloWord }; diff --git a/yarn.lock b/yarn.lock index 359127b..051e511 100644 --- a/yarn.lock +++ b/yarn.lock @@ -467,6 +467,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" +"@babel/plugin-syntax-flow@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.16.7.tgz#202b147e5892b8452bbb0bb269c7ed2539ab8832" + integrity sha512-UDo3YGQO0jH6ytzVwgSLv9i/CzMcUjbKenL67dTrAZPPv6GFAtDhe6jqnvmoKzC/7htNTohhos+onPtDMqJwaQ== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" @@ -625,6 +632,14 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" +"@babel/plugin-transform-flow-strip-types@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.16.7.tgz#291fb140c78dabbf87f2427e7c7c332b126964b8" + integrity sha512-mzmCq3cNsDpZZu9FADYYyfZJIOrSONmHcop2XEKPdBNMa4PDC4eEvcOvzZaCNcjKu72v0XQlA5y1g58aLRXdYg== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/plugin-syntax-flow" "^7.16.7" + "@babel/plugin-transform-for-of@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.7.tgz#649d639d4617dff502a9a158c479b3b556728d8c" @@ -874,6 +889,15 @@ core-js-compat "^3.20.2" semver "^6.3.0" +"@babel/preset-flow@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.16.7.tgz#7fd831323ab25eeba6e4b77a589f680e30581cbd" + integrity sha512-6ceP7IyZdUYQ3wUVqyRSQXztd1YmFHWI4Xv11MIqAlE4WqxBSd/FZ61V9k+TS5Gd4mkHOtQtPp9ymRpxH4y1Ug== + dependencies: + "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-validator-option" "^7.16.7" + "@babel/plugin-transform-flow-strip-types" "^7.16.7" + "@babel/preset-modules@^0.1.5": version "0.1.5" resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.5.tgz#ef939d6e7f268827e1841638dc6ff95515e115d9" @@ -1848,6 +1872,11 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +flow-bin@^0.175.1: + version "0.175.1" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.175.1.tgz#72237070ba4f293f9e04113481e18929c1de50df" + integrity sha512-zMCP0BPa9BrfBSR7QTcyT/XBwzUbyLdNG0eXvBuNxfHCbMRkUzSceRoOaEZIw+R+GH0UHjVfUvPJ30hXxz1Nfw== + form-data@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"