Flow: [Feature] Option to support whitelist of files to run`flow-upgrade` on

Created on 18 Aug 2017  路  9Comments  路  Source: facebook/flow

The flow-upgrade tool currently processes (almost all) files to have the .js extension. https://github.com/facebook/flow/blob/6c71ac69ecbe5a63def71a4f3b0d472a15ab3346/packages/flow-upgrade/src/findFlowFiles.js#L92

Two options:
1) It'd be great to have it support .jsx or other extensions.
2) We should be able to pass in a list of files manually.

Most helpful comment

If the linked PR to include jsx files lands, curious if those in this issue would already be happy, or if there's also demand for a manual way to pick file patterns?

All 9 comments

this would be really nice because I have a package of .jsx files so flow-upgrade is essentially useless unless I go through the process of doing a mass renaming to change the extension

Just encountered this as well. Was very surprised that .jsx files are not included given 0.53.0's push to support React, since JSX is arguably the de facto way to author React apps.

IMO, .jsx should be supported by default. A whitelist option would be a nice-to-have.

If the linked PR to include jsx files lands, curious if those in this issue would already be happy, or if there's also demand for a manual way to pick file patterns?

I'm fine with the current PR where it adds .jsx support. I don't see what other file types would even be needed, it's just React kind of pushes or suggests .jsx filenames so that's pretty widespread. Everything else would be incredibly niche.

Cool, I think we can close this issue unless anyone objects (/cc @calebmer)

Was this closed prematurely? The corresponding PR is still open.

Sorry, I was thinking the pr had landed. Happy to reopen until this issue is resolved, whether by the pr or some other way.

It really would be great to get the associated PR merged. I was scratching my head for a while trying to figure out why flow-upgrade didn't seem to be working.

Any updates on this? The tool just does nothing for our code base, which is React with most file extensions as jsx. Only tests files have the js file extension.

Update: I wanted to use this now, so I made a bash shell script that renames the jsx files and remembers the renamed ones, so it can restore only the correct files to their original extension later (after running flow-upgrade). See https://github.com/dfsp-spirit/tmp_change_file_ext if you want to use it.

Was this page helpful?
0 / 5 - 0 ratings