Skip to content
Discussion options

You must be logged in to vote

You do not strictly need all three, but they have separate jobs:

  • Husky runs the Git pre-commit hook.
  • lint-staged selects only staged paths and handles their edits safely.
  • Oxfmt formats the paths it receives.

For a Bun project, I would keep Husky + lint-staged and replace the formatter configuration with Oxfmt:

bun add -d husky lint-staged oxfmt
bunx husky init
# .husky/pre-commit
bunx lint-staged
{
  "scripts": {
    "prepare": "husky",
    "fmt": "oxfmt",
    "fmt:check": "oxfmt --check"
  },
  "lint-staged": {
    "*": "oxfmt --no-error-on-unmatched-pattern"
  }
}

The * matcher is intentional: lint-staged passes staged paths, Oxfmt formats the languages it supports, and --no-error-on-…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by raayonsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants