Skip to content

Apply style.hs to reflex + reflex-dom #504

Description

@ymeister

Apply style.hs to reflex + reflex-dom

https://github.com/obsidiansystems/style.hs

  • Add as a git submodule under dep/

  • Symlink fourmolu.yaml and .hlint.yaml to dep/style.hs/{fourmolu.yaml,.hlint.yaml}

  • Run ./fourmolu.yaml on source code directories (it's self-executing)

  • Run ./.hlint.yaml on source code directories (it's self-executing)

    • Resolve all hlint issues found. If the issue doesn't make sense to change, upstream it to style.hs hlint config and make a PR
  • Add check-fourmolu to release.nix. Example:

      check-fourmolu = pkgs.runCommand "check-fourmolu" {
        src = nix-thunk.haskellPackageSource;
        buildInputs = [
          # As with check-hlint, deliberately not given our own `pkgs`, so that CI
          # formats with the same fourmolu as `nix run github:obsidiansystems/style.hs`.
          (import ./dep/style.hs/fourmolu.nix {})
        ];
      } ''
        set -euo pipefail
    
        # --mode check exits non-zero rather than rewriting anything. The wrapper
        # supplies the bundled config, so no --config flag is needed.
        fourmolu --mode check "$src"
    
        touch "$out" # Make the derivation succeed if we get this far
      '';
    
    
  • Add check-hlint to release.nix. Example:

      check-hlint = pkgs.runCommand "check-hlint" {
        src = nix-thunk.haskellPackageSource;
        buildInputs = [
          # The shared Obsidian hlint, from the style.hs submodule. The wrapper
          # supplies its own bundled config, so no --hint flag is needed here.
          #
          # Deliberately *not* given our own `pkgs`: style.hs pins the hlint it was
          # written against (3.10), while our nixpkgs has 3.8, and the two disagree
          # about which hints fire. Using its pin keeps CI in step with what
          # `nix run github:obsidiansystems/style.hs#hlint` reports locally.
          (import ./dep/style.hs/hlint.nix {})
        ];
      } ''
        set -euo pipefail
    
        hlint "$src"
    
        touch "$out" # Make the derivation succeed if we get this far
      '';
    
    
  • Make sure it is part of CI checks

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions