Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check single file? #1451

Closed
mvolkmann opened this issue Feb 25, 2016 · 16 comments
Closed

check single file? #1451

mvolkmann opened this issue Feb 25, 2016 · 16 comments

Comments

@mvolkmann
Copy link
Contributor

It's great that the flow command checks all the files in a project, but is there any way to run it on a specific file? While learning I have many files in the current directory that each may have some type error. I want to run Flow on them one at a time to focus on learning a particular aspect.

@samwgoldman
Copy link
Member

@mvolkmann Well, you could do something like flow check-contents < path/to/file.js, but you might run into trouble with that, particularly if your file depends on other local modules, .flowconfig, etc. Hope it helps.

@mvolkmann
Copy link
Contributor Author

Yes, that is exactly what I need. Thanks!

@sibelius
Copy link

I've tried this

flow check-contents < src/actions/appActions.js 

And it returned this error

import * as types from './actionTypes';
                            ^^^^^^^^^^^^^^^ ./actionTypes. Required module not found

Can we check a single file and also include files that this file reference?

is there something for this?

@iddan
Copy link

iddan commented Jul 18, 2017

I'm working on this. Have a working POC. Should I go forward with this?

@sibelius
Copy link

@iddan please do

@iddan
Copy link

iddan commented Jul 19, 2017

It's written it in Node.js should I create a PR to the source in OCaml or is a POC reference is enough?

@sibelius
Copy link

I think you should create a POC and start a RFC about it

@iddan
Copy link

iddan commented Jul 19, 2017

https://github.com/iddan/flow-imports

@sibelius
Copy link

@iddan did your POC worked well?

@calebmer can flow focus-check reports only errors of selected files?

@iddan
Copy link

iddan commented Oct 31, 2017

My POC worked well. For some reason it is much more performant than flow focus-check

@sibelius
Copy link

You should publish it to npm

@iddan
Copy link

iddan commented Oct 31, 2017

It is just a sketch. What really should be is that the idea will be integrated to Flow and affect the editor extensions making Flow usable to the public

@malectro
Copy link
Contributor

for people landing on this page from google (like me)

flow check-contents path/to/file.js < path/to/file.js

will correctly set the current path and avoid all these import errors.

@mgtitimoli
Copy link

@samwgoldman can you give us some hints of why what @malectro wrote works?

@tunnckoCore
Copy link

tunnckoCore commented Aug 3, 2018

The thing is why we should duplicate our selfs and wirte same path two times? I knwo what < is, i'm linux guy for years. But.. It is also not cool for executing through things like Nodejs's spawn? Or.. how such things can be done programmatically? Without things such as cash and shelljs?

edit: Actually, i'm seeing that focus-check works well for what i described? What are the real differences between both commands? Except that one can handle from stdin.

@yanndinendal
Copy link
Contributor

(flow focus-check path/to/file.js can be used instead of flow check-contents path/to/file.js < path/to/file.js)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants