-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Support flow experimental.const_params=true #16228
Comments
This also affects react-native@0.49.0 |
Some of there errors seem to come from RN dependencies (fbjs from the sample you provided). I think it would be nice to fix but will require changing stuff across repos. If someone want to send a PR to fix some errors that are in this repo it would be nice. |
Hi @janicduplessis: I am a beginner in opensource contribution and like to work on this. |
@janicduplessis would like to work on this since it seems like an easy one for first timer. just to clarify, this would be to add |
I have a PR inbound for this. Should be submited today or tomorrow. |
@TakaGoto I'll tag you in my PR in case you'd like to submit any changes as well. You need to clone this repo, enable experimental.const_params and run flow. Most of the errors are fixed with a minor refactor. |
I really really want to do this. Unfortunately, we have a monorepo at facebook and everything is under a single flow config. If we merge this, it wouldn't change how flow treats these files internally and we'd be likely to break flow for everyone in open source very soon after this gets merged. Fortunately, I actually wrote a pretty intensive codemod for this at Facebook so we could convert our entire codebase and turn this flow config on. Unfortunately, there is a remaining issue with the codemod that has kept me from converting our entire codebase. The codemod erroneously converts:
into
If you would be interested in detecting this scope issue and getting the codemod to handle it, we'd be able (and happy) to make this change to react native. A PR (with tests) with our codemod from Facebook is here: cpojer/js-codemod#85 |
Very interesting. I'll take a look, thanks! |
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version? I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer. |
Silly bot |
👋 there - this issue is still technically "not fixed", for the reason Eli explained above. Basically every instance similar to this in the main codebase
would need to be changed to
There is a codemod Eli worked on -> cpojer/js-codemod#85 which would help a lot in automating this process, but there is a 1% cases in which it would conflict. So, all in all, there is a lot of work related to "code hygiene" - we'd love to see some PRs to help with this effort but it's really low prior right now. So I'm going to close it as there are more important tasks to focus on. |
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: macOS High Sierra 10.13
Node: 6.11.2
Yarn: 1.1.0
npm: 3.10.10
Watchman: 4.7.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: Not Found
Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: ^0.48.4 => 0.48.4
Steps to Reproduce
(Write your steps here:)
yarn add --dev flow-bin@^0.49.1
(same version specified in.flowconfig
)experimental.const_params=true
under[options]
in.flowconfig
./node_modules/.bin/flow
Expected Behavior
No errors.
(Write what you thought would happen.)
Actual Behavior
Reproducible Demo
https://github.com/ckknight/ReactNative-const_params-repro
The text was updated successfully, but these errors were encountered: