Skip to content

Commit 6990172

Browse files
authored
chore: add oxlint and pre-commit hooks (#61)
1 parent 044fd5a commit 6990172

12 files changed

Lines changed: 151 additions & 24 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
- name: Format check
3434
run: bun run format:check
3535

36+
- name: Lint
37+
run: bun run lint
38+
3639
- name: Typecheck
3740
run: bun run typecheck
3841

.github/workflows/pr-ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
- name: Format check
3737
run: bun run format:check
3838

39+
- name: Lint
40+
run: bun run lint
41+
3942
- name: Typecheck
4043
run: bun run typecheck
4144

.lintstagedrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{ts,tsx,js,jsx,mjs,cjs,mts,cts}": ["oxfmt --write", "oxlint --fix --deny-warnings"],
3+
"*.{json,jsonc,md,yml,yaml}": "oxfmt --write"
4+
}

.oxlintrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"no-control-regex": "off"
4+
}
5+
}

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ bun run format
4141
bun run format:check
4242
```
4343

44+
Lint the JS/TS codebase:
45+
46+
```bash
47+
bun run lint
48+
bun run lint:fix
49+
```
50+
51+
`bun install` also installs a local `pre-commit` hook that runs `lint-staged`, so staged JS/TS files are auto-formatted and linted before commit.
52+
4453
Build and verify the npm package:
4554

4655
```bash

bun.lock

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
"typecheck": "tsc --noEmit",
4646
"format": "oxfmt --write .",
4747
"format:check": "oxfmt --check .",
48+
"lint": "oxlint . --deny-warnings",
49+
"lint:fix": "oxlint . --fix",
50+
"prepare": "simple-git-hooks",
4851
"test": "bun test",
4952
"test:tty-smoke": "HUNK_RUN_TTY_SMOKE=1 bun test test/tty-render-smoke.test.ts",
5053
"check:pack": "bun run ./scripts/check-pack.ts",
@@ -69,9 +72,15 @@
6972
"devDependencies": {
7073
"@types/bun": "latest",
7174
"@types/react": "^19.2.14",
75+
"lint-staged": "^16.4.0",
7276
"oxfmt": "^0.41.0",
77+
"oxlint": "^1.56.0",
78+
"simple-git-hooks": "^2.13.1",
7379
"typescript": "^5.9.3"
7480
},
81+
"simple-git-hooks": {
82+
"pre-commit": "bunx lint-staged"
83+
},
7584
"engines": {
7685
"node": ">=18"
7786
},

scripts/publish-prebuilt-npm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,6 @@ for (const directory of directories) {
111111

112112
console.log(
113113
options.dryRun
114-
? `Completed npm publish dry-run for staged prebuilt packages with dist-tag \"${options.npmTag}\".`
115-
: `Published staged prebuilt packages to npm with dist-tag \"${options.npmTag}\".`,
114+
? `Completed npm publish dry-run for staged prebuilt packages with dist-tag "${options.npmTag}".`
115+
: `Published staged prebuilt packages to npm with dist-tag "${options.npmTag}".`,
116116
);

src/core/config.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ import fs from "node:fs";
22
import { dirname, join, resolve } from "node:path";
33
import type { CliInput, CommonOptions, LayoutMode, PersistedViewPreferences } from "./types";
44

5-
const CONFIG_SECTION_NAMES = [
6-
"pager",
7-
"git",
8-
"diff",
9-
"show",
10-
"stash-show",
11-
"patch",
12-
"difftool",
13-
] as const;
145
const DEFAULT_VIEW_PREFERENCES: PersistedViewPreferences = {
156
mode: "auto",
167
showLineNumbers: true,

src/mcp/daemonState.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ import type {
77
HunkSessionRegistration,
88
HunkSessionSnapshot,
99
ListedSession,
10-
ListCommentsToolInput,
1110
NavigateToHunkToolInput,
1211
NavigatedSelectionResult,
1312
RemoveCommentToolInput,
1413
RemovedCommentResult,
1514
SelectedSessionContext,
1615
SessionCommandResult,
17-
SessionLiveCommentSummary,
1816
SessionServerMessage,
1917
SessionTargetInput,
2018
} from "./types";

0 commit comments

Comments
 (0)