/* @flow strict */ 对所有源文件

/* @flow strict */ On all source files

使用 all=true 我可以让流程检查所有文件。 我如何将其扩展为严格检查所有文件?

我当前的.flowconfig:

[ignore]
.*/node_modules/.*

[libs]
flow-typed

[options]
all=true
module.use_strict=true

[strict]
nonstrict-import
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import

除非我在文件中键入 /* @flow strict */,否则不会应用最后的严格部分。如果可能,我想避免向所有文件添加评论:)

我的问题在 github 得到了回答:

As far as I understand strict, it's actually just setting all of the lints in [strict] to error. Try changing the [strict] section to [lints] and add =error to the end of each line. So:

[lints]
nonstrict-import=error
unclear-type=error
unsafe-getters-setters=error
untyped-import=error
untyped-type-import=error

That should set all of these lints as errors when flow type checks. Let me know if this isn't sufficient.

我只是link这里的答案:https://github.com/facebook/flow/issues/6967

遗憾的是我没有时间测试提供的解决方案,也许其他人可以确认?