Adding Flow

Having completed that, ESLint is set to recognize our code, but we have to configure Flow as well:

npm install --save-dev flow flow-bin flow-coverage-report flow-typed

We'll have to add a couple of lines to the scripts section of package.json:

"scripts": {
"start": "react-native-scripts start",
.
.
.
"flow": "flow",
"addTypes": "flow-typed install"
},

Then, we have to initialize the working directories of Flow:

npm run flow init

Finally, we can use the same .flowconfig files that we used earlier for React:

[ignore]
.*/node_modules/.*

[include]

[libs]

[lints]
all=warn
untyped-type-import=off
unsafe-getters-setters=off

[options]
include_warnings=true

[strict]

We are now set to use Flow, so we can keep working in the style we were accustomed to—we just have to add Prettier to format our code, and we'll be on our way!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.125.171