Skip to content

Commit

Permalink
flowconfig: HMRLoadingView ignore; better mimic FB internal .flowconfig.
Browse files Browse the repository at this point in the history
Part of the RN v0.59.10 -> v0.60.0 upgrade [1]. This commit has no
hard constraints on its position relative to the others in the
series, but at least one change (the `HMRLoadingView.js` ignore) is
not necessary until the upgrade.

Corresponds to facebook/react-native@0f909e331.

Leave in one inexplicable line that reveals huge numbers of errors
if removed, mostly in node_modules/react-native/Libraries (but some
in our code as well, e.g., `deprecated-utility` on the use of
`$Subtype` in `redux-persist/index.js.flow`.

```diff
- module.file_ext=.js
- module.file_ext=.jsx
- module.file_ext=.json
- module.file_ext=.native.js
  module.file_ext=.ios.js // This line
```

It's not there in the RN v0.60.0 template, but it's been in our repo
since e38869a, the upgrade from RN 0.51.0 to 0.52.0.

It doesn't seem to have ever been in the template app. The upgrade
helper showing the `rn-diff-purge` diff from RN 0.51.0 to 0.52.0 [1]
doesn't suggest adding that line, but I don't think that tool was
around when that other upgrade was done. Perhaps it was added from
experimentation, or there was another guide to upgrading.

Anyway, there's an open Flow issue [2], which was open at the time
of e38869a, one resolution of which is to include the line that
was included. So, keep including it.

[1]: https://react-native-community.github.io/upgrade-helper/?from=0.51.0&to=0.52.0

[2]: facebook/flow#945
  • Loading branch information
chrisbobbe committed May 23, 2020
1 parent 572b052 commit c2c7cdf
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
node_modules/react-native/Libraries/react-native/React.js

; Ignore polyfills
.*/Libraries/polyfills/.*
node_modules/react-native/Libraries/polyfills/.*

; Ignore metro
.*/node_modules/metro/.*
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js

; Custom ignores
.*/ios/Pods/*
Expand All @@ -28,6 +32,8 @@
.*/node_modules/flow-coverage-report/.*
.*/node_modules/@snyk/.*

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

[include]
; Effectively this line warns Flow that this path might be a symlink
Expand All @@ -51,18 +57,32 @@ flow-typed/@react-native-community/async-storage_v1.x.x.js
[strict]
; These apply only to files where `@flow strict` is enabled.
; See https://flow.org/en/docs/strict/ .

; from RN
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
sketchy-null


[lints]
; from RN
sketchy-null-number=warn
sketchy-null-mixed=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error

; ours
sketchy-number=error
unnecessary-optional-chain=warn
unnecessary-invariant=warn


[options]
Expand All @@ -86,8 +106,11 @@ module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*

munge_underscores=true

Expand All @@ -98,14 +121,10 @@ suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
module.file_ext=.ios.js

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
suppress_comment=\\(.\\|\n\\)*\\$FlowMigrationFudge
Expand Down

0 comments on commit c2c7cdf

Please sign in to comment.