Gleam utilities I regularly use while developing in gleam
devutils test lint gleam
README.md

gleam_devutils #

Gleam utilities for development. For now a custom test runner and additional linter rules.

Installation #

Add to your gleam.toml:

[dependencies]
gleam_devutils = "~> 0.0.1"

Functionality #

gleeunit #

A custom test runner that runs all tests in parallel. It's based on `gleeunit' and therefor the required modification are minimal.

Usage: Change

import gleeunit

pub fn main() -> Nil {
  gleeunit.main()
}

to

import devutils/gleeunit

pub fn main() -> Nil {
  gleeunit.main()
}

glinter rules #

Custom linting rules for use with the glinter tool.

label_possible_for_pub_fn #

Like the default `label_possible' rule it suggests adding labels to function parameters when they could benefit from them. But, only if the function is public.

Example:

// Linter warning: Parameters 'name' and 'greeting' could benefit from labels
pub fn greet(name, greeting) {
  greeting <> ", " <> name
}

// No linter warning: The function is private.
fn do_greet(name, greeting) {
  greeting <> ", " <> name
}

Usage with glinter:

// test/review.gleam
import glinter

import devutils/glinter/rules/label_possible_for_pub_fn

pub fn main() {
  glinter.run(extra_rules: [label_possible_for_pub_fn.rule()])
}

and run with

gleam run -m review