Skip to content

Commit aa0fb64

Browse files
committed
Add flow to package.
There is a purposely malformed `package.json` file in one of the dependencies (for testing purposes). We are using `.flowconfig` to ignore this file. See issue: facebook/flow#2364.
1 parent 3047a80 commit aa0fb64

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

.flowconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[ignore]
2+
.*/node_modules/resolve/test/resolver/malformed_package_json/package.json
3+
4+
5+
[include]
6+
7+
[libs]
8+
9+
[lints]
10+
11+
[options]
12+
13+
[strict]

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"babel": {
1313
"presets": [
14-
"@babel/preset-env"
14+
"@babel/preset-env",
15+
"@babel/preset-flow"
1516
]
1617
},
1718
"repository": "[email protected]:freckle/react-hooks.git",
@@ -22,6 +23,8 @@
2223
"@babel/cli": "^7.17.6",
2324
"@babel/core": "^7.17.9",
2425
"@babel/preset-env": "^7.16.11",
26+
"@babel/preset-flow": "^7.16.7",
27+
"flow-bin": "^0.175.1",
2528
"jest": "^27.5.1",
2629
"watch": "^1.0.2"
2730
}

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
const helloWord = () => "Hello, World!";
1+
// @flow
2+
3+
const helloWord = (): string => "Hello, World!";
24

35
export { helloWord };

yarn.lock

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,13 @@
467467
dependencies:
468468
"@babel/helper-plugin-utils" "^7.8.3"
469469

470+
"@babel/plugin-syntax-flow@^7.16.7":
471+
version "7.16.7"
472+
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.16.7.tgz#202b147e5892b8452bbb0bb269c7ed2539ab8832"
473+
integrity sha512-UDo3YGQO0jH6ytzVwgSLv9i/CzMcUjbKenL67dTrAZPPv6GFAtDhe6jqnvmoKzC/7htNTohhos+onPtDMqJwaQ==
474+
dependencies:
475+
"@babel/helper-plugin-utils" "^7.16.7"
476+
470477
"@babel/plugin-syntax-import-meta@^7.8.3":
471478
version "7.10.4"
472479
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51"
@@ -625,6 +632,14 @@
625632
"@babel/helper-builder-binary-assignment-operator-visitor" "^7.16.7"
626633
"@babel/helper-plugin-utils" "^7.16.7"
627634

635+
"@babel/plugin-transform-flow-strip-types@^7.16.7":
636+
version "7.16.7"
637+
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.16.7.tgz#291fb140c78dabbf87f2427e7c7c332b126964b8"
638+
integrity sha512-mzmCq3cNsDpZZu9FADYYyfZJIOrSONmHcop2XEKPdBNMa4PDC4eEvcOvzZaCNcjKu72v0XQlA5y1g58aLRXdYg==
639+
dependencies:
640+
"@babel/helper-plugin-utils" "^7.16.7"
641+
"@babel/plugin-syntax-flow" "^7.16.7"
642+
628643
"@babel/plugin-transform-for-of@^7.16.7":
629644
version "7.16.7"
630645
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.7.tgz#649d639d4617dff502a9a158c479b3b556728d8c"
@@ -874,6 +889,15 @@
874889
core-js-compat "^3.20.2"
875890
semver "^6.3.0"
876891

892+
"@babel/preset-flow@^7.16.7":
893+
version "7.16.7"
894+
resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.16.7.tgz#7fd831323ab25eeba6e4b77a589f680e30581cbd"
895+
integrity sha512-6ceP7IyZdUYQ3wUVqyRSQXztd1YmFHWI4Xv11MIqAlE4WqxBSd/FZ61V9k+TS5Gd4mkHOtQtPp9ymRpxH4y1Ug==
896+
dependencies:
897+
"@babel/helper-plugin-utils" "^7.16.7"
898+
"@babel/helper-validator-option" "^7.16.7"
899+
"@babel/plugin-transform-flow-strip-types" "^7.16.7"
900+
877901
"@babel/preset-modules@^0.1.5":
878902
version "0.1.5"
879903
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:
18481872
locate-path "^5.0.0"
18491873
path-exists "^4.0.0"
18501874

1875+
flow-bin@^0.175.1:
1876+
version "0.175.1"
1877+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.175.1.tgz#72237070ba4f293f9e04113481e18929c1de50df"
1878+
integrity sha512-zMCP0BPa9BrfBSR7QTcyT/XBwzUbyLdNG0eXvBuNxfHCbMRkUzSceRoOaEZIw+R+GH0UHjVfUvPJ30hXxz1Nfw==
1879+
18511880
form-data@^3.0.0:
18521881
version "3.0.1"
18531882
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"

0 commit comments

Comments
 (0)