Proposal to move to move to Flow types #1260
Description
Flow types will be introduced into the js-ipfs stack. We'll start with some smaller libraries and see how it goes. The goal is that it doesn't break existing things and the libraries can be used as before. If we find problems with that APIs due to adding types, those of course will be fixed.
If a new workflow is needed, it will be documented. Starting to contribute to a js-ipfs project shouldn't be any harder than it is now.
The tooling will change a bit. We introduce Prettier for automated code formatting as based on @Gozala's experience standardJS doesn't play that nice with Flow types. Though we will use the prettier-standard version so that the existing code base doesn't need to be changed too much and people used to coding in standardJS won't see their code reformatted too heavily.
The npm commands like test
, lint
, release
are expected to work as usual. They might not use AEgir from the start, but eventually the tools/code needed will be merged into AEgir.
Let's stick to the original plan and get js-cid
Flow types. In order to achieve that, port all the multiformats projects before that:
- js-multihash - feat: add flow type annotations multiformats/js-multihash#49
- Add flow type annotations. multiformats/js-multiaddr#51
- feat: add flow annotations multiformats/js-multihashing#27
- https://github.com/multiformats/js-multibase
- https://github.com/multiformats/js-multistream-select
- https://github.com/multiformats/js-multihashing-async
- https://github.com/multiformats/js-multicodec
- https://github.com/ipld/js-cid (needs almost all the above)
This awesome endeavor is lead by @vmx.
References:
- Initial discussions: https://github.com/ipfs/community/issues/278
- Discussions on the first PR implementing it in js-multihash: Add flow type annotations. multiformats/js-multihash#47