I was wondering how I have to setup .flowConfig in order to use flow on a React- Native project. I created an empty .flowConfig file but as soon as I include the react-native module in a JS source file and check this file with flow, flow displays a 'not_found' error message.
Let's get started We start by initializing a new React Native project (without Expo) by running: npx react-native init flow in our terminal where 'flow' is the name of the project. This can be any valid name you want. Try and run the bare app on your device or emulator.
Flow will help you prevent bugs and allow for better code documentation among other things. A lot of the React Native documentation and source code already also uses flow, so there has never been a better time to start using it!
flowconfig file tells Flow to include the specified library definitions when type checking your code. Multiple libraries can be specified. By default, the flow-typed folder in your project root directory is included as a library directory.
Follow the instructions on https://flowtype.org/ to create your projects .flowconfig
file, you can copy and paste it, you also have to install flow via brew install flow
and add the flow binaries to your package.json
, once you've done all this, you should be able to manually run flow and check for error types, but, that is not really optimal.
I haven't been able to set up flow on atom without using nuclide, I'm guessing with some digging around the packages you can find something that works that allows for on-the-fly flow checking.
The link provided by @jerome (https://egghead.io/lessons/react-setup-nuclide-to-use-flow-and-eslint-mac) is useful but only for nuclide installation, still worth a watch.
I advise to watch https://egghead.io/lessons/react-setup-nuclide-to-use-flow-and-eslint-mac it explains how to use Flow with Nuclide. I had issue to make flow works and my main mistake was that I didn't install flow (brew install flow). On the official site (https://flowtype.org/docs/getting-started.html) they don't mention you need to install flow (or it is not super obvious if it is the case). Anyway watch the video it is great, it even explains ESLint :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With