Flow
Install babel plugin
@babel/preset-flow#Installation 참조.
flowconfig
프로젝트에 .flowconfig
파일을 만들고 아래 내용을 추가한다.
[ignore]
<PROJECT_ROOT>/node_modules/.*
[include]
<PROJECT_ROOT>/src/.*
[libs]
[lints]
[options]
[strict]
Ignore
위의 예제와 같은 프로젝트 디렉토리는 <PROJECT_ROOT>로 표현하면 된다.
Prepare Your Code for Flow
The Flow background process monitors all Flow files. However, how does it know which files are Flow files and, thus, should be checked? Placing the following before any code in a JavaScript file is the flag the process uses to answer that question.
This flag is in the form of a normal JavaScript comment annotated with @flow
. The Flow background process gathers all the files with this flag and uses the type information available from all of these files to ensure consistency and error free programming.
You can also use the form ``/* @flow */`` for the flag as well.
For files in your project without this flag, the Flow background process skips and ignores the code (unless you call flow check --all
, which is beyond the scope of basic usage).