Skip to content

Commit

Permalink
'源码'
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoAlone committed Mar 17, 2021
1 parent 77524e1 commit 293e476
Show file tree
Hide file tree
Showing 272 changed files with 119,458 additions and 27 deletions.
11 changes: 11 additions & 0 deletions .flowconfig
@@ -0,0 +1,11 @@
[ignore]

[include]

[libs]

[lints]

[options]

[strict]
54 changes: 28 additions & 26 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions flow/配置.md
Expand Up @@ -6,3 +6,41 @@
"flow":"flow check"
}
```
执行:
```
npm run flow init
```
生成flow配置文件.flowconfig
```$xslt
[ignore]
.*/node_modules/.*
.*/test/.*
.*/build/.*
.*/config/.*
[include]
[libs]
[options]
module.file_ext=.vue
module.file_ext=.js
```
[ignore]:Flow 默认检查项目目录下所有文件,但是有很多文件必定是我们不想检查的,就像 node_modules、build 等目录下的文件,所以我们需要在将这些目录写在 ignore 配置下。

[include]:所谓的项目目录其实是 .flowconfig 目录,并不是真正的项目目录,如果我们在这个项目中的某个目录下创建一个 .flowconfig,那么 .flowconfig 所在的目录也会变为一个 Flow 项目。那么,如果我们想对当前 Flow 项目以外的文件或者目录进行检查,需要把它们写在 include 配置项中。

[libs]:在项目中,我们可能会用到很多自定义的类型,比如说要记录对象的结构,它可能在每个文件中都会被运用到,我们将其抽取为全局的类型或数据结构,在任何文件都可以使用。为了管理方便,我们将全局类型都定义在一个或多个单纯的目录中统一管理。这里存放的有可能是一个定义好的数据结构,存放的也有可能是根据项目中某个类对应的数据类型。我们将这些文件或目录写在 libs 配置项中,这个配置对于我们使用 Flow 来说很重要。

[options]:这里填写对 Flow 项目的一些配置,配置项以key=value的形式,每行写一个。所有的配置见官方文档

[lints]:官网中没有提到 lints 相关的配置
###从编译后的代码中去除 Flow 语法
Flow通过类型注释的语法拓展了javascript,但浏览器无法解析,所以需要确保在编译时不会讲flow的语法
编译到bundle中去
```$xslt
npm install --save-dev babel-cli babel-preset-flow
```

参考<br>
[vue项目配置flow](https://www.yht7.com/news/31458)
[静态类型检查](https://zh-hans.reactjs.org/docs/static-type-checking.html)
12 changes: 12 additions & 0 deletions node_modules/.bin/flow

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/flow.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/flow.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions node_modules/flow-bin/SHASUM256.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/flow-bin/cli.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added node_modules/flow-bin/flow-linux64-v0.146.0/flow
Binary file not shown.
Binary file added node_modules/flow-bin/flow-osx-v0.146.0/flow
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions node_modules/flow-bin/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions node_modules/flow-bin/license

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions node_modules/flow-bin/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 293e476

Please sign in to comment.