Skip to content

Commit 2651112

Browse files
committed
feat: Switch to oxlint and dprint
1 parent 0ff616a commit 2651112

File tree

11 files changed

+5337
-2994
lines changed

11 files changed

+5337
-2994
lines changed

.github/CONTRIBUTING.MD

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
Thank you for your interest in contributing! This document explains how to set up your environment, make changes safely, and submit high‑quality pull requests.
44

5-
65
## Prerequisites
76

87
- Node.js (see .nvmrc file)
@@ -16,7 +15,6 @@ pnpm install
1615
pnpm prepare # installs Husky if hooks are present
1716
```
1817

19-
2018
## Development workflow
2119

2220
- Start the dev server: `pnpm dev`
@@ -27,7 +25,6 @@ pnpm prepare # installs Husky if hooks are present
2725

2826
Build output goes to `web/` and should not be edited directly.
2927

30-
3128
## Environment configuration
3229

3330
We use Vite modes and `.env.*` files. You can `cp .env.local.example .env.local` to get started fast.
@@ -42,7 +39,6 @@ Some commonly used variables:
4239

4340
See `.env.prod` for a production example. For local development, create `.env.local` based on `.env.local.example`.
4441

45-
4642
## Commit conventions
4743

4844
We use Conventional Commits and commitlint to keep history clean and to power semantic-release.
@@ -64,7 +60,6 @@ chore(ci): update workflow names
6460

6561
Useful types include: feat, fix, perf, refactor, chore, docs, style, test, build, ci, revert.
6662

67-
6863
## Testing
6964

7065
- Framework: Vitest (see `vitest.config.ts`)
@@ -73,17 +68,14 @@ Useful types include: feat, fix, perf, refactor, chore, docs, style, test, build
7368

7469
Where practical, add or update unit tests for your changes.
7570

76-
7771
## Linting and style
7872

79-
- ESLint is configured in `eslint.config.js` with TypeScript, React Hooks, and React Refresh plugins.
80-
- Run: `pnpm lint`
81-
- Auto-fix: `pnpm exec eslint . --fix`
73+
- Linting: OXLint (`pnpm lint`, `pnpm lint:fix`)
74+
- Formatting: dprint (`pnpm format`, `pnpm format:fix`)
8275
- Type-check: `pnpm exec tsc -b`
8376

8477
We use Tailwind CSS; prefer utility classes and shared components for consistency.
8578

86-
8779
## Generating the API types (SDK)
8880

8981
If your change depends on updated Central Manager API types:
@@ -95,7 +87,6 @@ pnpm update-sdk
9587

9688
This fetches the OpenAPI spec into `dist/central-manager.json` and generates `src/integrations/api/api.gen.d.ts`.
9789

98-
9990
## Branching and pull requests
10091

10192
- Create feature branches from the main development branch.
@@ -106,15 +97,13 @@ This fetches the OpenAPI spec into `dist/central-manager.json` and generates `sr
10697

10798
Releases are automated from the `stage` branch via semantic-release.
10899

109-
110100
## Code review guidelines
111101

112102
- Prefer clear, readable code over “clever” code.
113103
- Add comments where intent isn’t obvious.
114104
- Avoid introducing unused dependencies.
115105
- Keep changes backward compatible when feasible.
116106

117-
118107
## Questions
119108

120109
If you’re unsure about anything, open a draft PR early or start a discussion. We’re happy to help get you unblocked quickly.

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pnpm test
22
pnpm lint
3+
pnpm format:staged

.oxlintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"ignorePatterns": [
3+
"src/integrations/api/*.gen.d.ts",
4+
"src/assets/**"
5+
]
6+
}

.prettierrc

Lines changed: 0 additions & 22 deletions
This file was deleted.

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
SHELL := /bin/bash
99
PNPM := pnpm
1010

11-
.PHONY: help install prepare dev dev-local build build-dev build-stage build-prod build-local preview lint lint-fix typecheck test test-watch update-sdk clean
11+
.PHONY: help install prepare dev dev-local build build-dev build-stage build-prod build-local preview lint lint-fix format format-fix typecheck test test-watch update-sdk clean
1212

1313
help:
1414
@echo "Available targets:"
@@ -22,8 +22,10 @@ help:
2222
@echo " build-prod - Build using --mode prod"
2323
@echo " build-local - Build using --mode localstudio"
2424
@echo " preview - Preview the built app from web/"
25-
@echo " lint - Run ESLint"
26-
@echo " lint-fix - Run ESLint with --fix"
25+
@echo " lint - Run code linter to check files"
26+
@echo " lint-fix - Run code linter and automatically apply fixes, where possible"
27+
@echo " format - Check formatting of code"
28+
@echo " format-fix - Fix formatting of code automatically"
2729
@echo " typecheck - Run TypeScript project references build (type-check)"
2830
@echo " test - Run tests once (Vitest)"
2931
@echo " test-watch - Run tests in watch mode"
@@ -64,7 +66,13 @@ lint:
6466
$(PNPM) lint
6567

6668
lint-fix:
67-
$(PNPM) exec eslint . --fix
69+
$(PNPM) lint:fix
70+
71+
format:
72+
$(PNPM) format
73+
74+
format-fix:
75+
$(PNPM) format:fix
6876

6977
typecheck:
7078
$(PNPM) exec tsc -b

README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ It is also the source for the bundled “Local Studio” UI that ships with the
88
- Tech stack: React, Vite, TypeScript, Tailwind CSS, TanStack Router/Query/Table
99
- Package manager: pnpm (see package.json `packageManager`)
1010

11-
1211
## Quick start (develop this repo)
1312

1413
Prerequisites:
14+
1515
- Node.js (see .nvmrc)
1616
- pnpm (the version in `package.json#packageManager` is recommended)
1717

@@ -27,17 +27,18 @@ pnpm dev:local
2727
Builds are emitted to `web/` (see `vite.config.ts`). The `web/` directory is build output; don’t edit it by hand.
2828

2929
Common scripts:
30+
3031
- `pnpm dev` — start Vite dev server
3132
- `pnpm dev:local` — start in Local Studio mode
3233
- `pnpm build` — type-check then build for production
3334
- `pnpm build:dev|stage|prod|local` — build for a specific mode
3435
- `pnpm preview` — serve the built `web/`
3536
- `pnpm test` / `pnpm test:watch` — run unit tests (Vitest)
36-
- `pnpm lint` — run ESLint
37+
- `pnpm lint` — run code linting (use `pnpm lint:fix` to write changes)
38+
- `pnpm format` — check formatting of code (use `pnpm format:fix` to write changes)
3739

3840
Tip: prefer using the Makefile shortcuts in `Makefile` if you like `make` (e.g. `make dev`, `make build-prod`).
3941

40-
4142
## Using this app via Harper (Local Studio)
4243

4344
If you would like to run the Studio UI locally via Harper itself, install and start Harper with Local Studio enabled. At runtime, Harper will serve the compiled UI from this repository.
@@ -46,12 +47,11 @@ Open your harperdb-config.yaml and enable localStudio:
4647

4748
```yaml
4849
localStudio:
49-
enabled: true
50+
enabled: true
5051
```
5152
5253
Then visit http://localhost:9925 (or wherever you've set your operations port) to access the Local Studio. The default dev URL used by this repo is `http://localhost:9925` (see `VITE_LOCAL_STUDIO_DEV_URL`).
5354

54-
5555
## Environments and configuration
5656

5757
This project uses Vite environment files and modes. You can pass `--mode <name>` to Vite to pick a `.env.<name>` file. Some keys you may encounter:
@@ -72,10 +72,10 @@ VITE_ENV_NAME=dev
7272
```
7373

7474
Notes:
75+
7576
- A production example is in `.env.prod`.
7677
- Building for a specific environment uses the matching mode: `pnpm build:dev`, `pnpm build:stage`, or `pnpm build:prod`.
7778

78-
7979
## OpenAPI SDK generation
8080

8181
This repository can generate TypeScript definitions from the Central Manager OpenAPI schema.
@@ -91,29 +91,30 @@ HDB_ADMIN_PASSWORD_FOR_OPENAPI=<password>
9191
```
9292

9393
What the script does:
94-
1) Downloads `${VITE_CENTRAL_MANAGER_API_URL}/openapi` into `./dist/central-manager.json` using the admin credentials
95-
2) Runs `openapi-typescript` to generate `src/integrations/api/api.gen.d.ts`
9694

95+
1. Downloads `${VITE_CENTRAL_MANAGER_API_URL}/openapi` into `./dist/central-manager.json` using the admin credentials
96+
2. Runs `openapi-typescript` to generate `src/integrations/api/api.gen.d.ts`
9797

9898
## Linting, formatting, and type-checking
9999

100-
- ESLint: configured in `eslint.config.js` with TypeScript, React Hooks, and React Refresh plugins
100+
- Linting: OXLint
101101
- TypeScript: strict project references via `tsconfig.json` and `tsconfig.app.json`
102102
- Tailwind CSS: configured via `@tailwindcss/vite`; styles are colocated with components
103103

104104
Run locally:
105-
- `pnpm lint`
106-
- `pnpm exec eslint . --fix` to auto-fix
107-
- `pnpm exec tsc -b` to type-check
108105

106+
- `pnpm lint` — run code linter
107+
- `pnpm lint:fix` — auto-fix lint issues where possible
108+
- `pnpm format` — check code formatting
109+
- `pnpm format:fix` — write code formatting changes where possible
110+
- `pnpm exec tsc -b` — type-check
109111

110112
## Testing
111113

112114
- Test runner: Vitest (see `vitest.config.ts`)
113115
- Run once: `pnpm test`
114116
- Watch mode: `pnpm test:watch`
115117

116-
117118
## Commit conventions and release
118119

119120
This repo enforces Conventional Commits via commitlint. Please format your commit messages like:
@@ -130,19 +131,16 @@ chore(ci): update workflow names
130131

131132
Useful commit types include: feat, fix, perf, refactor, chore, docs, style, test, build, ci, revert.
132133

133-
134134
## Contributing
135135

136136
Please see .github/CONTRIBUTING.MD for detailed guidelines, including how to run checks locally and how to structure your pull requests.
137137

138-
139138
## Troubleshooting
140139

141140
- Dev server won’t start: ensure Node 20+ and pnpm installed; remove `node_modules` and reinstall.
142141
- API calls failing in dev: verify `VITE_CENTRAL_MANAGER_API_URL` and any required auth are correct for your environment/mode.
143142
- Local Studio not showing: ensure your Harper process has `localStudio: { enabled: true }` and is listening on the port you expect (default 9925).
144143

145-
146144
## License
147145

148146
This project is proprietary to Harper. If you’re unsure about usage or licensing, please contact the maintainers.

dprint.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"typescript": {
3+
"quoteStyle": "preferSingle",
4+
"jsx.quoteStyle": "preferDouble",
5+
"useTabs": true,
6+
"useBraces": "always"
7+
},
8+
"json": {
9+
"useTabs": true
10+
},
11+
"markdown": {},
12+
"markup": {},
13+
"yaml": {
14+
"quotes": "preferSingle"
15+
},
16+
"graphql": {
17+
"useTabs": true
18+
},
19+
"excludes": [
20+
"**/node_modules",
21+
"**/*-lock.json",
22+
"pnpm-lock.yaml",
23+
"src/assets/**",
24+
"src/integrations/api/api.gen.d.ts"
25+
],
26+
"plugins": [
27+
"https://plugins.dprint.dev/typescript-0.95.13.wasm",
28+
"https://plugins.dprint.dev/json-0.21.0.wasm",
29+
"https://plugins.dprint.dev/markdown-0.20.0.wasm",
30+
"https://plugins.dprint.dev/g-plane/markup_fmt-v0.25.1.wasm",
31+
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm",
32+
"https://plugins.dprint.dev/g-plane/pretty_graphql-v0.2.3.wasm"
33+
]
34+
}

eslint.config.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
"release": "semantic-release",
1717
"update-sdk": "dotenv -e .env.local -- npm run update-sdk:fetch && npx -y openapi-typescript --root-types --alphabetize --enum ./dist/central-manager.json -o src/integrations/api/api.gen.d.ts",
1818
"update-sdk:fetch": "mkdir -p dist && curl --location \"$VITE_CENTRAL_MANAGER_API_URL/openapi\" -u \"$HDB_ADMIN_USERNAME_FOR_OPENAPI:$HDB_ADMIN_PASSWORD_FOR_OPENAPI\" -o ./dist/central-manager.json",
19-
"lint": "eslint .",
19+
"lint": "oxlint .",
20+
"lint:fix": "oxlint . --fix",
21+
"format": "dprint check",
22+
"format:fix": "dprint fmt",
23+
"format:staged": "dprint check --staged",
2024
"prepare": "husky",
2125
"test": "vitest run",
2226
"test:watch": "vitest",
@@ -72,7 +76,6 @@
7276
"devDependencies": {
7377
"@commitlint/cli": "^20.0.0",
7478
"@commitlint/config-conventional": "^20.0.0",
75-
"@eslint/js": "^9.19.0",
7679
"@semantic-release/commit-analyzer": "^13.0.0",
7780
"@semantic-release/github": "^12.0.0",
7881
"@semantic-release/release-notes-generator": "^14.0.0",
@@ -84,16 +87,13 @@
8487
"@vitejs/plugin-react": "^5.0.0",
8588
"@vitest/coverage-v8": "^4.0.0",
8689
"dotenv-cli": "^11.0.0",
87-
"eslint": "^9.19.0",
88-
"eslint-plugin-react-hooks": "^7.0.0",
89-
"eslint-plugin-react-refresh": "^0.4.18",
90-
"globals": "^16.0.0",
90+
"dprint": "^0.50.2",
9191
"harperdb": "4.7.11",
9292
"husky": "^9.1.7",
9393
"jsdom": "^27.0.0",
94+
"oxlint": "^1.32.0",
9495
"semantic-release": "^25.0.0",
9596
"typescript": "~5.9.0",
96-
"typescript-eslint": "^8.22.0",
9797
"vite": "^7.0.0",
9898
"vitest": "^4.0.0"
9999
},

0 commit comments

Comments
 (0)