mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-01-12 22:46:30 +08:00
docs: update Flow documentation (#7550)
* docs: update Flow documentation * Update adding-flow.md * Update adding-flow.md
This commit is contained in:
committed by
Ian Sutherland
parent
64662822dd
commit
24780bbc60
@@ -14,8 +14,15 @@ To add Flow to a Create React App project, follow these steps:
|
||||
3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flow.org/en/docs/config/) in the root directory.
|
||||
4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`).
|
||||
|
||||
Now you can run `npm run flow` (or `yarn flow`) to check the files for type errors.
|
||||
You can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience.
|
||||
In the future we plan to integrate it into Create React App even more closely.
|
||||
Now you can run `npm run flow` (or `yarn flow`) to check the files for type errors.
|
||||
You can optionally enable an extension for your IDE, such as [Flow Language Support](https://github.com/flowtype/flow-for-vscode) for Visual Studio Code, or leverage the Language Server Protocol standard (e.g. [vim LSP](https://github.com/prabirshrestha/vim-lsp/wiki/Servers-Flow)) to get hints while you type.
|
||||
|
||||
If you'd like to use [absolute imports](/docs/importing-a-component#absolute-imports) with Flow,
|
||||
make sure to add the following line to your `.flowconfig` to make Flow aware of it:
|
||||
|
||||
```diff
|
||||
[options]
|
||||
+ module.name_mapper='^\(.*\)$' -> '<PROJECT_ROOT>/src/\1'
|
||||
```
|
||||
|
||||
To learn more about Flow, check out [its documentation](https://flow.org/).
|
||||
|
||||
Reference in New Issue
Block a user