braid-protocol
braid-protocol copied to clipboard
Prefer not to use "export default"
I'd prefer to use "export [name]" instead of "export default" and "module.exports =". The main reason is that our library can give reasonable naming expectations to users of this library, which improves the ecosystem's legibility.
For example, if user A
says import braid from "@josephg/braid-server
in their code, while user B
says import stream from "@josephg/braid-server"
this adds unnecessary confusion to newcomers looking across code bases that use our library.
As far as I know, there is very little downside to named exports--if a user is particularly opinionated and really wants to override our naming expections, they can always reach for import { stream as braid } from "@josephg/braid-server
or const braid = require("@josephg/braid-server").stream
if they want to.