flow focus-check
allows to check a single file, which can be useful in some cases.
In other cases, it would be helpful to get focus-check
to check all files received as arguments. For example, to use together with https://github.com/okonet/lint-staged and have only the staged files being checked.
This should be possible:
flow focus-check a.js b.js
Actual result:
flow: unexpected argument 'b.js'.
Any updates on this? Would be great to have.
Also interested in this. Jest has the flag --findRelatedTests
which handles this perfectly. One potential lint-staged setup (with the proposed feature) would look something along the lines of:
"lint-staged": {
"*.js": [
"eslint --fix --ignore-pattern '**/*.test.js'",
"jest --bail --findRelatedTests",
"flow related-check",
"git add"
]
}
Lint, run tests, and type-check before commits.
Improved performance of flow focus-check for multiple files
https://github.com/facebook/flow/releases/tag/v0.56.0
I checked it out, it works.
Can someone clarify how focus-check
works? Didn't find any documentation on this command.
As I understand it checks all the dependencies of provided files and dependencies of dependencies. And as the result in my case when I provide any 2 files, it returns 850 errors (I have 859 errors in total).
Is there a way to still check all dependencies (I understand this is required) but display only errors found in provided files?
We want to fix all flow errors gradually with pre-commit hook, not all of them at once.
can we filter the result of focus-check
to only the selected files?
Can we have an update about the question above?
For further motivation of adding feature asked about in @sibelius post above, flow focus-check
is needed for usage with arc lint
or tools like pre-commit
. If multiple files share a dependency, the output will be littered with duplicate errors, making things more difficult to parse.
Most helpful comment
Also interested in this. Jest has the flag
--findRelatedTests
which handles this perfectly. One potential lint-staged setup (with the proposed feature) would look something along the lines of:Lint, run tests, and type-check before commits.