Rough draft. Borrows from other style guides such as Github and Elm.
Pull requests must compile without warnings and be elm-format
ted.
- Do not include issue numbers in the PR title
- Include screenshots and animated GIFs in your pull request whenever possible.
- Run
elm-format
on your code before submitting, ideally have it run every save. - Include a
{-| Comment block detailing the function -}
above every new top function. - If it compiles but with warnings, get rid of them first, please.
- If it doesn't compile, we don't want it.
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
- Consider starting the commit message with an applicable emoji:
- 🎨
:art:
when improving the format/structure of the code - 🐎
:racehorse:
when improving performance - 📝
:memo:
when improving documentation - 🐧
:penguin:
when fixing something on Gnu/Linux - 🍎
:apple:
when fixing something on macOS - 🏁
:checkered_flag:
when fixing something on Windows - 🐛
:bug:
when fixing a bug - 🔥
:fire:
when removing code or files - ✅
:white_check_mark:
when adding tests - 🔒
:lock:
when dealing with security - ⬆️
:arrow_up:
when upgrading dependencies - ⬇️
:arrow_down:
when downgrading dependencies - 👕
:shirt:
when removing linter warnings
- 🎨
- Import everything such that it would provide the shortest qualifiers, unless it completely conflicts with another module.
- For example:
import Html.Styled.Attributes exposing (..)
andimport Html.Styled.Attributes exposing (..)
- This causes the ambiguity with the
checked
function, so the compiler will force you to qualify it asCss.checked
orHtml.Styled.Attributes.checked
.
- This is perfectly fine. In these cases, just pick the correct prefix and add it.
- Most other functions do not conflict, so it is worth it.
- This causes the ambiguity with the
- Counterexample:
import Json.Decode exposing (..)
andimport Json.Encode exposing (..)
- These modules have lots of functions of the same name.
- Using most functions, such as
string
, would cause ambiguity errors- The compiler would force us to write either
Json.Encode.string
orJson.Decode.string
- That's a lot of long qualifiers
- The compiler would force us to write either
- Solution:
import Json.Decode as Decode exposing (..)
andimport Json.Encode as Encode exposing (..)
- Bam. Now we only ever need to type as much as
Decode.string
orEncode.string
- Bam. Now we only ever need to type as much as
- For example: