.flowconfig [include]
指定 Flow 包含的檔案
預設情況下 Flow 會將專案目錄下的所有加上
// @flow
的 .js 檔納入檢查,除此之外,我們還可以自行決定要包含、隱藏哪些檔案或目錄。.flowconfig
中 [include]
部分就是在指定要「包含」的部分。可以指定為單個檔案、目錄、或是以 *
或 **
表示全部等等。若是指定為目錄,則回遞迴的將目錄下所有子目錄的檔案都包含進去。[include]
底下的每一行即代表一個規則,這些規則都是由專案根目錄出發 ( 也就是 .flowconfig
的那層目錄 )。預設的話一定會包含專案根目錄 ( 不管有沒有自己添加規則都會包含進去 )
如果我們有一個設定檔
/path/to/root/.flowconfig
定義了這樣的 [include]
內容[include]
../externalFile.js
../externalDir/
../otherProject/*.js
../otherProject/**/coolStuff/
當 Flow 從
/path/to/root
專案執行檢查後,他會檢查以下項目- 1.
/path/to/root/
底下所有 flow 檔案 ( 自動包含的 ) - 2.
/path/to/externalFile.js
- 3.
/path/to/externalDir/
- 4.
/path/to/otherProject/
目 錄下所有.js
檔 - 5.
/path/to/otherProject/
子目錄下所有名為coolSutff/
的子目錄
也就是這樣
/path/to/
├── root/ # 預設包含底下所有檔案
├── externalFile.js # 包含
├── externalDir/ # 包含底下所有檔案
└── otherProject/
├── coolStuff
│ └── index.js # 不包含
├── dir001
│ └── index.js # 包含
├── dir002
│ └── coolStuff
│ └── index.js # 包含
├── dir003
│ └── index.js # 包含
└── main.js # 包含
Last modified 2yr ago