Skip to content

Instantly share code, notes, and snippets.

@JesterXL
Last active February 28, 2022 20:44
Show Gist options
  • Save JesterXL/c69c192c756f16ff8ab7d38419176e0f to your computer and use it in GitHub Desktop.
Save JesterXL/c69c192c756f16ff8ab7d38419176e0f to your computer and use it in GitHub Desktop.
Elm Review Rules on Mon, Feb 28th, 2022

Elm Review Rules Architectural Design Record

Status

Proposed

Context

While Elm has an idiomatic way to do things regarding the architecture, there are various ways to use types and code. Much like JavaScript and Python have linting rules, Elm does as well to help enforce best practices that the team deems important.

Decision

My team have had multiple meetings to discuss the pro's/con's of each rule, and have decided on the following lists below. Inlcuded shows which ones we currently have enabled or want to. Not included are ones we reviewed but didn't want.

Included

We need to figure these out; they require more investigations of costs and/or how to best configure.

Not Included

  • NoDebug.Log: this is enforced by the elm compiler --optimize flag, but we turned off because we need to be able to debug before we go to production.
  • NoDebug.TodoOrToString: Same as above
  • NoUnusedPorts: While dead code is bad, you may still be figuring out how best to encode/decode in Elm. I don't think this should fail the build, but we could be convinced otherwise.
  • NoEmptyText: While this sounded great at first, this really makes it hard to build a design from scratch when you're figuring things out. Html.nothing is better, yes, but CSS requires experiementation, and this rule gets in the way of that.
  • NoMissingTypeAnnotationInLetIn: let is your escape hatch into imperative land, let's not punish people for writing hard to grok code in steps. Refactor later? Sure, but shouldn't fail the build.
  • NoMissingTypeExpose: I'm not smart enough to know if this will affect phantom types, so have disabled for now.
  • Docs.NoMissing: This is great for libraries, but we're not building those yet. This isn't applicable to applications.
  • NoMissingSubscriptionsCall: This is for n00bs to Elm.
  • NoAlways: We couldn't figure out why this was bad.
  • Documentation-ReadmeLinksPointToCurrentVersion: We're not doing libraries yet.

Consequences

Enforcing these rules locally can be done via npm run review and the same command is run in the pipeline. If a rule becomes painful, or one is missing because of context (such as documentation for libraries), then we can re-access the rules. Thes are not set in stone. As we learn more about Elm, we reserve the right to change our minds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment