Skip to content

Dev: Add Husky + lint-staged pre-commit hook #26

@evans-sam

Description

@evans-sam

Problem

Nothing runs locally before a commit. Formatting and lint failures are only discovered in CI, causing avoidable round-trips.

Why it matters

Fast feedback at commit time > slow feedback at PR time. Also standardizes the dev experience across contributors.

Proposed approach

  1. Install husky and lint-staged as devDependencies.
  2. Add .husky/pre-commit running npx lint-staged.
  3. Configure lint-staged in package.json:
"lint-staged": {
  "*.ts": ["eslint --fix", "prettier --write"],
  "*.{json,md,yml}": ["prettier --write"]
}
  1. Add postinstall script: husky install.
  2. Document in CONTRIBUTING.md.

A superpowers:setup-pre-commit skill exists that does most of this — consider invoking it.

Acceptance criteria

  • Committing a badly-formatted file triggers the hook.
  • CONTRIBUTING.md mentions the hook and how to bypass (--no-verify) with caution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    oss-hygieneCommunity health, governance, contributor UXtech-debtTechnical debt / code quality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions