Summary: Turn on xplat warnings individually rather than all at once. This makes it easier for the team to add new lints that we don't necessarily want to enable globally.
Reviewed By: panagosg7
Differential Revision: D13993571
fbshipit-source-id: 019f301f584be268fdcbf5b0540f63ce6fcd54e3
Summary: Now that Flow v0.92.1 is deployed, we can backout {D13942380}, which was a temporary fix.
Reviewed By: avikchaudhuri
Differential Revision: D13952515
fbshipit-source-id: d423379a03fff09316aa499e1152b410a1bb4178
Summary: Flow v0.92 is crashing sometimes after a save when run through Nuclide. This fixes the issue temporarily until we can push a Flow v0.92.1
Reviewed By: samwgoldman
Differential Revision: D13942380
fbshipit-source-id: f7bf2aef0aab90980bbb786d89710f399c9427d5
Summary:
This updates React Native to use latest CLI. We also create Metro configuration, because CLI looks for React Native in "node_modules" by default. Since we are running React Native from source, it will fail to find required files.
To avoid hacky logic to detect if we are running from source backed into the CLI, I decided to leverage the Metro configuration instead.
Pull Request resolved: https://github.com/facebook/react-native/pull/23052
Reviewed By: rickhanlonii
Differential Revision: D13719938
Pulled By: cpojer
fbshipit-source-id: 1f40a40b3cdbb07ccd42daf75feb457556d3e40f
Summary: Upgrades flow in xplat/js to 0.91. This diff also adds and removes suppressions.
Reviewed By: samwgoldman
Differential Revision: D13720697
fbshipit-source-id: 1bf8830ce286db92277476a2d2404cf0c0dddca2
Summary: Remove `$Subtype` and `$Supertype` utilities. Replacement was done on a best-effort basis. In many cases it sufficed to replace `$Supertype<T>` and `$Subtype<T>` with `T`, but when this was not possible `any | T` and `any & T` were used instead.
Reviewed By: jbrown215
Differential Revision: D13624765
fbshipit-source-id: 82ee9d43cfc318ed4bd2d84e0f4c5c1d8f488a9c
Summary:
These comments were confusing since we don't use flow-typed.
cc bvaughn.
I have replaced our local types by flow-typed, removed metro custom stub and deleted `flow-github` directory.
As result, createReactClass, PropTypes and Metro types won't be distributed to RN users. If you need it, you should relay on flow-typed.
Pull Request resolved: https://github.com/facebook/react-native/pull/20320
Reviewed By: TheSavior
Differential Revision: D13517157
Pulled By: rickhanlonii
fbshipit-source-id: e52c0b6114114a706f6152b2031c600e3dece0d2
Summary: This diff moves the React Native template from `local-cli/templates/HelloWorld` to `template`. Keeping it in the react-native repo will allow us to make changes to the template and version it together with react-native, instead of moving it out into a separate repo and trying to keep the template in sync with RN.
Reviewed By: TheSavior
Differential Revision: D13372949
fbshipit-source-id: e68e267b4dcf6384535d7b48fc11e297a12e9676
Summary: This is one more step to remove `fbjs` from `react-native-github`. This changes both the internal and external code to use `invariant` from zertosh instead of the copy in fbjs.
Reviewed By: yungsters
Differential Revision: D13195941
fbshipit-source-id: 73564ca1715110e7da9c7ef56dc57374d61377e0
Summary: Stop ignoring `metro` folder from RN and use their flowtypes correctly
Reviewed By: hramos
Differential Revision: D13085169
fbshipit-source-id: f285223afb7e89ac2c63e53d36be2f3645fa6761
Summary:
We don't want people requiring from this file via haste. This file is the main for the react-native yarn workspace requireable via require('react-native').
https://pxl.cl/jnWC
Reviewed By: mostafaeweda, RSNara
Differential Revision: D10444200
fbshipit-source-id: 3832857e3df01def128525f32c9735e928802b59
Summary: was using `[foo|bar]` to match `foo` or `bar` instead of `\\(foo\\|bar\\)` (ocaml/emacs regexes are the worst). this meant that the "site" part of FlowFixMe and FlowIssue suppression comments were basically not working, so a suppression in one site suppressed the other incorrectly.
Reviewed By: jbrown215
Differential Revision: D10365477
fbshipit-source-id: 1188c7378b5e6fd3090b27c1aa54480efdd09250
Summary: The controller you requested could not be found.
Reviewed By: gabelevi
Differential Revision: D9390604
fbshipit-source-id: 68ba89ba197f74322e4c85c3bfc1f334fb740852
Summary:
Most of the changes associated with this commit will not be visible on GitHub, as they concern files in the internal Facebook monorepo. The bulk of this change is the addition of a new test that runs on the internal test infrastructure. The actual script used by the test has various references to the internal test infra, but a copy is produced below with some changes that should allow it to run on open source should anyone be interested in testing this outside of Facebook.
The test has the main goal of catching common sources of FB-to-GitHub breakages, such as the OSS Flow config falling out of date (we use a different flow config than what is synced out in .flowconfig, and hence internally we rename this file to .github.flowconfig). It also checks that the packager can run on a brand new project, among other things.
```
set -e
THIS_DIR=$(pwd)
REACT_NATIVE_TEMP_DIR=$(mktemp -d /tmp/react-native-XXXXXXXX)
REACT_NATIVE_APP_TEMP_DIR=$(mktemp -d /tmp/react-native-XXXXXXXX)
OFFLINE_MIRROR=$(yarn config get yarn-offline-mirror)
function describe {
printf "\\n\\n>>>>> %s\\n\\n\\n" "$1"
}
function cleanup {
set +e
rm -rf "$REACT_NATIVE_TEMP_DIR"
rm -rf "$REACT_NATIVE_APP_TEMP_DIR"
rm "$OFFLINE_MIRROR/react-native-v1000.0.0.tgz"
set -e
}
trap cleanup EXIT
describe "Creating temporary react-native-github clone"
cp -R "react-native" "$REACT_NATIVE_TEMP_DIR"
pushd "$REACT_NATIVE_TEMP_DIR/react-native" >/dev/null
echo yarn-offline-mirror="$OFFLINE_MIRROR" > .npmrc
describe "Installing react-native node_modules from offline cache"
yarn install --mutex network --offline --frozen-lockfile --ignore-engines --ignore-scripts 2>&1
describe "Running a Flow check"
mv .github.flowconfig .flowconfig
./node_modules/.bin/flow check
describe "Running a basic packager test"
touch .watchmanconfig
node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
describe "Creating package for e2e test"
yarn pack
REACT_NATIVE_PACKAGE="$(pwd)/react-native-v1000.0.0.tgz"
REACT_VERSION=$(node -p -e "require('./package.json').peerDependencies['react']")
REACT_NATIVE_HASH=$(shasum "$REACT_NATIVE_PACKAGE" | awk '{print $1;}')
REACT_NATIVE_DEPS=$(node -p -e "const deps=require('./package.json').dependencies; ' ' + Object.keys(deps).map(dep => dep + ' \"' + deps[dep] +'\"').join('\n ')")
popd >/dev/null
describe "Installing temporary RN app"
mkdir "$REACT_NATIVE_APP_TEMP_DIR/PackagerTest"
pushd "$REACT_NATIVE_APP_TEMP_DIR/PackagerTest" >/dev/null
cp "$REACT_NATIVE_PACKAGE" ./
cp "$REACT_NATIVE_PACKAGE" "$OFFLINE_MIRROR"
cp "$REACT_NATIVE_TEMP_DIR/react-native/.npmrc" ./
cp "$REACT_NATIVE_TEMP_DIR/react-native/yarn.lock" ./
cat <<LOCKFILE >> yarn.lock
react-native@1000.0.0:
version "1000.0.0"
resolved react-native-v1000.0.0.tgz#$REACT_NATIVE_HASH
dependencies:
$REACT_NATIVE_DEPS
LOCKFILE
cat > package.json <<- EndOfFile
{
"name": "packager-test",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "$REACT_VERSION",
"react-native": "1000.0.0"
}
}
EndOfFile
yarn install --mutex network --offline --frozen-lockfile --ignore-engines --ignore-scripts 2>&1
sed -e s/"HelloWorld"/PackagerTest/g "react-native/local-cli/templates/HelloWorld/app.json" > app.json
cp "react-native/local-cli/templates/HelloWorld/_buckconfig" .buckconfig
cp "react-native/local-cli/templates/HelloWorld/_flowconfig" .flowconfig
cp "react-native/local-cli/templates/HelloWorld/_watchmanconfig" .watchmanconfig
cp "react-native/local-cli/templates/HelloWorld/App.js" App.js
cp "react-native/local-cli/templates/HelloWorld/index.js" index.js
describe "Running a Flow check on a new RN app"
flow check
describe "Verifying packager can produce JS bundle for a new RN app on both platforms"
node ./node_modules/react-native/local-cli/cli.js bundle --platform ios --dev true --entry-file index.js --bundle-output ios-bundle.js
test -e ios-bundle.js
rm ios-bundle.js
node ./node_modules/react-native/local-cli/cli.js bundle --platform android --dev true --entry-file index.js --bundle-output android-bundle.js
test -e android-bundle.js
rm android-bundle.js
popd >/dev/null
```
Reviewed By: arcanis
Differential Revision: D9129463
fbshipit-source-id: a91eeaa150ae6623ee67bd758bc8a98bb31e57b8
Summary:
Adds a .github.flowconfig.android.
Also, adds the optional _ios and _android to the sites.
Reviewed By: TheSavior
Differential Revision: D9189935
fbshipit-source-id: 5274701b9425525337d5c4684ce4ffee841fef52
Summary: The controller you requested could not be found.
Reviewed By: pakoito
Differential Revision: D9174188
fbshipit-source-id: 4ec9ef5b6f802964a83b6bc0bd29db7f47b37c21
Summary:
Follow up to a9792ac4c8. I assume it's enabled for fb flow config so we can avoid future breakages if someone decide to use this syntax.
Pull Request resolved: https://github.com/facebook/react-native/pull/20516
Differential Revision: D9169244
Pulled By: TheSavior
fbshipit-source-id: 3736d2aed65a0cb4392c175f7d652594cf6a1518
Summary:
There's a couple of Flow errors in open source, following D9081343:
```
yarn run v1.6.0
$ flow check
Error --------------------------------------------------------------------- Libraries/Components/Switch/Switch.js:139:31
Experimental optional chaining (`?.`) usage. Optional chaining is an active early-stage feature proposal that may
change. You may opt in to using it anyway by putting `esproposal.optional_chaining=enable` into the `[options]` section
of your `.flowconfig`.
139| let _trackColorForFalse = trackColor?.false;
^^^^^^^^^^^^^^^^^
Error --------------------------------------------------------------------- Libraries/Components/Switch/Switch.js:140:30
Experimental optional chaining (`?.`) usage. Optional chaining is an active early-stage feature proposal that may
change. You may opt in to using it anyway by putting `esproposal.optional_chaining=enable` into the `[options]` section
of your `.flowconfig`.
140| let _trackColorForTrue = trackColor?.true;
^^^^^^^^^^^^^^^^
```
See https://circleci.com/gh/facebook/react-native/48701
We have a different Flow config for open source, .github.flowconfig, that needs to be updated to ensure Flow passes in oss.
Reviewed By: TheSavior
Differential Revision: D9141134
fbshipit-source-id: 7b546ef4c9a91bdd66472242f38a6fc8bcf86364
Summary: No new errors in this version. Just removed a bunch of unused suppressions
Reviewed By: TheSavior
Differential Revision: D8754160
fbshipit-source-id: 2f02240b6d65edecba5d9ed603c7703462547a7f
Summary:
We enforce this config locally in fbsource, lets ensure our flow strict files are run the same way in the github repo.
@public
Reviewed By: sahrens
Differential Revision: D8530133
fbshipit-source-id: 18528992ad6490826431359d5d8c6acd6710a8ae
Summary:
In this repo we have to require from fbjs/lib/invariant and issues occur when we require directly from invariant/warning. Flow doesn't complain about those requires right now because we have a transitive dependency on invariant and warning causing them to happen to be at the root of node_modules.
This change blacklists requiring directly from invariant and warning using Flow. janicduplessis opened a pull request to do this with ESLint back in 2017: https://github.com/facebook/react-native/pull/13014
Closes https://github.com/facebook/react-native/pull/19634
Reviewed By: hramos
Differential Revision: D8343060
Pulled By: TheSavior
fbshipit-source-id: 9cfc7915b2fb68a567355fc2f5edc4dfcd46f4af
Summary:
This PR removes the need for having the `providesModule` tags in all the modules in the repository.
It configures Flow, Jest and Metro to get the module names from the filenames (`Libraries/Animated/src/nodes/AnimatedInterpolation.js` => `AnimatedInterpolation`)
* Checked the Flow configuration by running flow on the project root (no errors):
```
yarn flow
```
* Checked the Jest configuration by running the tests with a clean cache:
```
yarn jest --clearCache && yarn test
```
* Checked the Metro configuration by starting the server with a clean cache and requesting some bundles:
```
yarn run start --reset-cache
curl 'localhost:8081/IntegrationTests/AccessibilityManagerTest.bundle?platform=android'
curl 'localhost:8081/Libraries/Alert/Alert.bundle?platform=ios'
```
[INTERNAL] [FEATURE] [All] - Removed providesModule from all modules and configured tools.
Closes https://github.com/facebook/react-native/pull/18995
Reviewed By: mjesun
Differential Revision: D7729509
Pulled By: rubennorte
fbshipit-source-id: 892f760a05ce1fddb088ff0cd2e97e521fb8e825