Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pnpm install

### Linting and formatting

This repository uses [oxlint](https://oxc.rs/docs/guide/usage/linter) (with type-aware rules) for linting and [oxfmt](https://oxc.rs/docs/guide/usage/formatter) for formatting.
This repository uses [oxlint](https://oxc.rs/docs/guide/usage/linter) (with type-aware rules) for linting and [oxfmt](https://oxc.rs/docs/guide/usage/formatter) for formatting. A [lefthook](https://lefthook.dev) pre-commit hook runs `oxfmt` and `oxlint --fix` on staged files, and is installed by `pnpm install`.

```
pnpm lint
Expand Down
13 changes: 13 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# https://lefthook.dev/configuration/
pre-commit:
piped: true
jobs:
- name: fmt
glob: '*.{js,jsx,ts,tsx,mjs,cjs,json,jsonc,css,md,yml,yaml}'
exclude: '*.lock.yml'
run: pnpm exec oxfmt --no-error-on-unmatched-pattern {staged_files}
stage_fixed: true
- name: lint
glob: '*.{js,jsx,ts,tsx,mjs,cjs}'
run: pnpm exec oxlint --fix {staged_files}
stage_fixed: true
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
"fmt:check": "oxfmt --check",
"lint": "oxlint",
"lint:fix": "oxlint --fix",
"prepare": "lefthook install || true",
"test": "vitest",
"test:ci": "vitest run"
},
"devDependencies": {
"@arethetypeswrong/core": "0.18.5",
"@changesets/cli": "3.0.3",
"lefthook": "2.2.2",
"oxfmt": "0.79.0",
"oxlint": "1.94.0",
"oxlint-tsgolint": "7.0.2005",
Expand Down
109 changes: 109 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
packages:
- 'packages/*'
allowBuilds:
lefthook: true