What are the module naming conventions for scoped npm packages?

interop

#1

Suppose I have an NPM package @marblejs/core and if I am writing ReasonML bindings for this package, what are the naming conventions for module names?

Two things come to my mind:

  1. Marblejs.Core - Looks more intuitive
  2. MarblejsCore

#2

BuckleScript by default sets up projects that are ‘wrapped’ inside a top-level module derived from the scope and project name. So, by default, if you have a project @marblejs/core, BuckleScript will automatically put all its modules inside a Marblejscore toplevel module. See https://bucklescript.github.io/docs/en/build-configuration#name-namespace

If you know what you’re doing, you can turn off this default namespacing, but have to ensure all your module names are unique to avoid clashes with other projects; so in practice you’ll have to manually name your files something like Marblejs_Core_Something.re. I wrote up something explaining this, https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd