Skip to content

Commit 70cf9b4

Browse files
committed
flow: Enable enums!
Following a Flow doc: https://flow.org/en/docs/enums/enabling-enums/#toc-enable-enums Note that we add the `flow-enums-runtime` dependency as a production dependency, but we don't import it anywhere. That's as requested by the doc.
1 parent dee75af commit 70cf9b4

File tree

4 files changed

+35
-9
lines changed

4 files changed

+35
-9
lines changed

.flowconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,7 @@ module.file_ext=.ios.js
122122
; we're error-free!
123123
exact_by_default=true
124124

125+
enums=true
126+
125127
[version]
126128
^0.162.0

babel.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,15 @@ module.exports = {
1313
// @babel/reset-env, but that doesn't get used as a base plugin; see a
1414
// comment on that issue explaining why.
1515
'@babel/plugin-proposal-numeric-separator',
16+
17+
// Flow enums:
18+
// https://flow.org/en/docs/enums/enabling-enums/#toc-enable-enums
19+
[
20+
'@babel/plugin-syntax-flow',
21+
// Required by 'transform-flow-enums':
22+
// https://www.npmjs.com/package/babel-plugin-transform-flow-enums
23+
{ enums: true }
24+
],
25+
'transform-flow-enums'
1626
],
1727
};

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"expo-screen-orientation": "~4.1.1",
4444
"expo-sqlite": "^10.0.0",
4545
"expo-web-browser": "~10.1.0",
46+
"flow-enums-runtime": "^0.0.6",
4647
"immutable": "^4.0.0-rc.12",
4748
"invariant": "^2.2.4",
4849
"katex": "^0.11.1",
@@ -90,6 +91,7 @@
9091
"@rollup/plugin-node-resolve": "^13.0.4",
9192
"@types/react-native": "^0.67.7",
9293
"@vusion/webfonts-generator": "^0.8.0",
94+
"babel-plugin-transform-flow-enums": "^0.0.2",
9395
"core-js": "^3.1.4",
9496
"deep-freeze": "^0.0.1",
9597
"eslint": "^8.15.0",

yarn.lock

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@
212212
dependencies:
213213
"@babel/types" "^7.16.7"
214214

215-
"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.17.12", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
216-
version "7.17.12"
217-
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.17.12.tgz#86c2347da5acbf5583ba0a10aed4c9bf9da9cf96"
218-
integrity sha512-JDkf04mqtN3y4iAbO1hv9U2ARpPyPL1zqyWs/2WG1pgSq9llHFjStX5jdxb84himgJm+8Ng+x0oiWF/nw/XQKA==
215+
"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.17.12", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
216+
version "7.18.9"
217+
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz#4b8aea3b069d8cb8a72cdfe28ddf5ceca695ef2f"
218+
integrity sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w==
219219

220220
"@babel/helper-remap-async-to-generator@^7.16.8":
221221
version "7.16.8"
@@ -526,12 +526,12 @@
526526
dependencies:
527527
"@babel/helper-plugin-utils" "^7.8.3"
528528

529-
"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.14.5", "@babel/plugin-syntax-flow@^7.17.12", "@babel/plugin-syntax-flow@^7.2.0":
530-
version "7.17.12"
531-
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.17.12.tgz#23d852902acd19f42923fca9d0f196984d124e73"
532-
integrity sha512-B8QIgBvkIG6G2jgsOHQUist7Sm0EBLDCx8sen072IwqNuzMegZNXrYnSv77cYzA8mLDZAfQYqsLIhimiP1s2HQ==
529+
"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.12.1", "@babel/plugin-syntax-flow@^7.14.5", "@babel/plugin-syntax-flow@^7.17.12", "@babel/plugin-syntax-flow@^7.2.0":
530+
version "7.18.6"
531+
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.18.6.tgz#774d825256f2379d06139be0c723c4dd444f3ca1"
532+
integrity sha512-LUbR+KNTBWCUAqRG9ex5Gnzu2IOkt8jRJbHHXFT9q+L9zm7M/QQbEqXyw1n1pohYvOyWC8CjeyjrSaIwiYjK7A==
533533
dependencies:
534-
"@babel/helper-plugin-utils" "^7.17.12"
534+
"@babel/helper-plugin-utils" "^7.18.6"
535535

536536
"@babel/plugin-syntax-import-assertions@^7.17.12":
537537
version "7.17.12"
@@ -3897,6 +3897,13 @@ babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0:
38973897
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf"
38983898
integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ==
38993899

3900+
babel-plugin-transform-flow-enums@^0.0.2:
3901+
version "0.0.2"
3902+
resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-enums/-/babel-plugin-transform-flow-enums-0.0.2.tgz#d1d0cc9bdc799c850ca110d0ddc9f21b9ec3ef25"
3903+
integrity sha512-g4aaCrDDOsWjbm0PUUeVnkcVd6AKJsVc/MbnPhEotEpkeJQP6b8nzewohQi7+QS8UyPehOhGWn0nOwjvWpmMvQ==
3904+
dependencies:
3905+
"@babel/plugin-syntax-flow" "^7.12.1"
3906+
39003907
babel-preset-current-node-syntax@^1.0.0:
39013908
version "1.0.1"
39023909
resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b"
@@ -7421,6 +7428,11 @@ flow-coverage-report@^0.8.0:
74217428
terminal-table "^0.0.12"
74227429
yargs "^16.0.3"
74237430

7431+
flow-enums-runtime@^0.0.6:
7432+
version "0.0.6"
7433+
resolved "https://registry.yarnpkg.com/flow-enums-runtime/-/flow-enums-runtime-0.0.6.tgz#5bb0cd1b0a3e471330f4d109039b7eba5cb3e787"
7434+
integrity sha512-3PYnM29RFXwvAN6Pc/scUfkI7RwhQ/xqyLUyPNlXUp9S40zI8nup9tUSrTLSVnWGBN38FNiGWbwZOB6uR4OGdw==
7435+
74247436
flow-parser@0.*:
74257437
version "0.180.0"
74267438
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.180.0.tgz#05d49a88715ceca0457607499a018e2bf5908d72"

0 commit comments

Comments
 (0)