From cc0bd13d4dafc934caa8a97c6d98c32dc28e4e9e Mon Sep 17 00:00:00 2001 From: Florian Imdahl Date: Tue, 15 Sep 2026 14:35:09 +0200 Subject: [PATCH] chore: Replace prettier with oxfmt --- AGENTS.md | 2 +- lefthook.yml | 4 +- oxfmt.config.ts | 8 ++ package.json | 11 +-- tsconfig.json | 2 +- yarn.lock | 248 ++++++++++++++++++++++++++++++++++++++++++++---- 6 files changed, 245 insertions(+), 30 deletions(-) create mode 100644 oxfmt.config.ts diff --git a/AGENTS.md b/AGENTS.md index 86d034a4..46ddac5f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -96,7 +96,7 @@ yarn start:dev # start + NODE_DEBUG yarn start:prod # node dist/src/index.js yarn lint # oxlint yarn test # run Vitest test suite -yarn fix # auto-fix lint issues + prettier +yarn fix # auto-fix lint issues + oxfmt ``` ## CI/CD diff --git a/lefthook.yml b/lefthook.yml index c45715e5..ec6a7174 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,12 +1,12 @@ pre-commit: parallel: false commands: - prettier: + oxfmt: glob: '*.{js,ts,css,csv,md,json,yml,yaml}' exclude: - 'CLAUDE.md' - '.claude' - run: npx --no -- prettier --write {staged_files} && git add {staged_files} + run: npx --no oxfmt {staged_files} && git add {staged_files} oxlint: glob: '*.{js,ts}' run: npx --no -- oxlint --ignore-path .gitignore --fix {staged_files} && git add {staged_files} diff --git a/oxfmt.config.ts b/oxfmt.config.ts new file mode 100644 index 00000000..338629cf --- /dev/null +++ b/oxfmt.config.ts @@ -0,0 +1,8 @@ +import {defineConfig} from 'oxfmt'; + +import config from '@ffflorian/oxfmt-config'; + +export default defineConfig({ + ...config, + ignorePatterns: ['**/dist/**', '**/node_modules/**', '**/.yarn/**'], +}); diff --git a/package.json b/package.json index cd4ad480..3a1adb9f 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ }, "description": "Find the source of an npm package in an instant.", "devDependencies": { + "@ffflorian/oxfmt-config": "1.2.0", "@ffflorian/oxlint-config": "1.0.5", - "@ffflorian/prettier-config": "1.0.2", "@types/express": "5.0.6", "@types/node": "~26", "@types/validate-npm-package-name": "4.0.2", @@ -24,8 +24,8 @@ "eslint": "10.10.0", "eslint-plugin-perfectionist": "5.11.0", "lefthook": "2.1.12", + "oxfmt": "0.68.0", "oxlint": "1.82.0", - "prettier": "3.9.6", "tsx": "4.23.13", "type-fest": "5.9.0", "typescript": "6.0.3", @@ -48,7 +48,6 @@ "main": "dist/index.js", "name": "pkgsource", "packageManager": "yarn@4.18.0", - "prettier": "@ffflorian/prettier-config", "repository": "https://github.com/ffflorian/pkgsource.git", "scripts": { "build": "tsc", @@ -56,12 +55,12 @@ "dev": "yarn start:dev", "dist": "yarn clean && yarn build", "fix": "yarn fix:ts && yarn fix:other", - "fix:other": "yarn prettier --write", + "fix:other": "yarn format", "fix:ts": "yarn lint:ts --fix", + "format": "oxfmt \"*.{json,md,yml}\"", "lint": "yarn lint:other && yarn lint:ts", - "lint:other": "yarn prettier --list-different", + "lint:other": "yarn format --check", "lint:ts": "oxlint --ignore-path .gitignore .", - "prettier": "prettier \"*.{json,md,yml}\"", "start:prod": "node dist/index.js", "start": "tsx src/index.ts", "start:dev": "NODE_DEBUG=\"pkgsource/*\" tsx src/index.ts", diff --git a/tsconfig.json b/tsconfig.json index a62e9500..e7979e63 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,5 +24,5 @@ "target": "es2017", "types": ["node"] }, - "exclude": ["dist", "node_modules", "test", "eslint.config.ts", "vitest.config.ts"] + "exclude": ["dist", "node_modules", "test", "eslint.config.ts", "vitest.config.ts", "oxfmt.config.ts"] } diff --git a/yarn.lock b/yarn.lock index bb5ef740..4fadc68d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -332,6 +332,15 @@ __metadata: languageName: node linkType: hard +"@ffflorian/oxfmt-config@npm:1.2.0": + version: 1.2.0 + resolution: "@ffflorian/oxfmt-config@npm:1.2.0" + peerDependencies: + oxfmt: ">=0.68.0" + checksum: 10c0/8574573715cf073d583e573dbeba8c88323b9534c3e2c50e217bb52a71aafa3da2b3846d58951d3daee229a9fe1b7d8632d6bef78c70c3b597518be3f15d16c0 + languageName: node + linkType: hard + "@ffflorian/oxlint-config@npm:1.0.5": version: 1.0.5 resolution: "@ffflorian/oxlint-config@npm:1.0.5" @@ -343,15 +352,6 @@ __metadata: languageName: node linkType: hard -"@ffflorian/prettier-config@npm:1.0.2": - version: 1.0.2 - resolution: "@ffflorian/prettier-config@npm:1.0.2" - peerDependencies: - prettier: ">= 1.17.0" - checksum: 10c0/d6450a265b2f068265c40111a55b65fc5aea66476cf69f85b3fa8e5bba5542663beceebd51d44860c3ce0885fac92f74603a32b05ebbf5228a3c02200bac9a10 - languageName: node - linkType: hard - "@humanfs/core@npm:^0.19.2": version: 0.19.2 resolution: "@humanfs/core@npm:0.19.2" @@ -608,6 +608,139 @@ __metadata: languageName: node linkType: hard +"@oxfmt/binding-android-arm-eabi@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-android-arm-eabi@npm:0.68.0" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-android-arm64@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-android-arm64@npm:0.68.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-darwin-arm64@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-darwin-arm64@npm:0.68.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-darwin-x64@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-darwin-x64@npm:0.68.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@oxfmt/binding-freebsd-x64@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-freebsd-x64@npm:0.68.0" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm-gnueabihf@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-arm-gnueabihf@npm:0.68.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm-musleabihf@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-arm-musleabihf@npm:0.68.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm64-gnu@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-arm64-gnu@npm:0.68.0" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm64-musl@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-arm64-musl@npm:0.68.0" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-linux-ppc64-gnu@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-ppc64-gnu@npm:0.68.0" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-riscv64-gnu@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-riscv64-gnu@npm:0.68.0" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-riscv64-musl@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-riscv64-musl@npm:0.68.0" + conditions: os=linux & cpu=riscv64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-linux-s390x-gnu@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-s390x-gnu@npm:0.68.0" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-x64-gnu@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-x64-gnu@npm:0.68.0" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-x64-musl@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-linux-x64-musl@npm:0.68.0" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-openharmony-arm64@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-openharmony-arm64@npm:0.68.0" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-arm64-msvc@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-win32-arm64-msvc@npm:0.68.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-ia32-msvc@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-win32-ia32-msvc@npm:0.68.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-x64-msvc@npm:0.68.0": + version: 0.68.0 + resolution: "@oxfmt/binding-win32-x64-msvc@npm:0.68.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@oxlint/binding-android-arm-eabi@npm:1.82.0": version: 1.82.0 resolution: "@oxlint/binding-android-arm-eabi@npm:1.82.0" @@ -3180,6 +3313,83 @@ __metadata: languageName: node linkType: hard +"oxfmt@npm:0.68.0": + version: 0.68.0 + resolution: "oxfmt@npm:0.68.0" + dependencies: + "@oxfmt/binding-android-arm-eabi": "npm:0.68.0" + "@oxfmt/binding-android-arm64": "npm:0.68.0" + "@oxfmt/binding-darwin-arm64": "npm:0.68.0" + "@oxfmt/binding-darwin-x64": "npm:0.68.0" + "@oxfmt/binding-freebsd-x64": "npm:0.68.0" + "@oxfmt/binding-linux-arm-gnueabihf": "npm:0.68.0" + "@oxfmt/binding-linux-arm-musleabihf": "npm:0.68.0" + "@oxfmt/binding-linux-arm64-gnu": "npm:0.68.0" + "@oxfmt/binding-linux-arm64-musl": "npm:0.68.0" + "@oxfmt/binding-linux-ppc64-gnu": "npm:0.68.0" + "@oxfmt/binding-linux-riscv64-gnu": "npm:0.68.0" + "@oxfmt/binding-linux-riscv64-musl": "npm:0.68.0" + "@oxfmt/binding-linux-s390x-gnu": "npm:0.68.0" + "@oxfmt/binding-linux-x64-gnu": "npm:0.68.0" + "@oxfmt/binding-linux-x64-musl": "npm:0.68.0" + "@oxfmt/binding-openharmony-arm64": "npm:0.68.0" + "@oxfmt/binding-win32-arm64-msvc": "npm:0.68.0" + "@oxfmt/binding-win32-ia32-msvc": "npm:0.68.0" + "@oxfmt/binding-win32-x64-msvc": "npm:0.68.0" + tinypool: "npm:2.1.2" + peerDependencies: + svelte: ^5.0.0 + vite-plus: "*" + dependenciesMeta: + "@oxfmt/binding-android-arm-eabi": + optional: true + "@oxfmt/binding-android-arm64": + optional: true + "@oxfmt/binding-darwin-arm64": + optional: true + "@oxfmt/binding-darwin-x64": + optional: true + "@oxfmt/binding-freebsd-x64": + optional: true + "@oxfmt/binding-linux-arm-gnueabihf": + optional: true + "@oxfmt/binding-linux-arm-musleabihf": + optional: true + "@oxfmt/binding-linux-arm64-gnu": + optional: true + "@oxfmt/binding-linux-arm64-musl": + optional: true + "@oxfmt/binding-linux-ppc64-gnu": + optional: true + "@oxfmt/binding-linux-riscv64-gnu": + optional: true + "@oxfmt/binding-linux-riscv64-musl": + optional: true + "@oxfmt/binding-linux-s390x-gnu": + optional: true + "@oxfmt/binding-linux-x64-gnu": + optional: true + "@oxfmt/binding-linux-x64-musl": + optional: true + "@oxfmt/binding-openharmony-arm64": + optional: true + "@oxfmt/binding-win32-arm64-msvc": + optional: true + "@oxfmt/binding-win32-ia32-msvc": + optional: true + "@oxfmt/binding-win32-x64-msvc": + optional: true + peerDependenciesMeta: + svelte: + optional: true + vite-plus: + optional: true + bin: + oxfmt: bin/oxfmt + checksum: 10c0/61ec3e39b214cfc1a2f9c209f74f51616face24418b426a914479193e0589cfe1cdbf3a170c71d26f3d4dda5596628a7dcda20bbfd0c48fdab3856e7e2d555ea + languageName: node + linkType: hard + "oxlint@npm:1.82.0": version: 1.82.0 resolution: "oxlint@npm:1.82.0" @@ -3363,8 +3573,8 @@ __metadata: version: 0.0.0-use.local resolution: "pkgsource@workspace:." dependencies: + "@ffflorian/oxfmt-config": "npm:1.2.0" "@ffflorian/oxlint-config": "npm:1.0.5" - "@ffflorian/prettier-config": "npm:1.0.2" "@nestjs/common": "npm:12.0.1" "@nestjs/core": "npm:12.0.1" "@nestjs/platform-express": "npm:12.0.1" @@ -3379,9 +3589,9 @@ __metadata: helmet: "npm:8.3.0" lefthook: "npm:2.1.12" logdown: "npm:3.3.1" + oxfmt: "npm:0.68.0" oxlint: "npm:1.82.0" package-json: "npm:10.0.1" - prettier: "npm:3.9.6" reflect-metadata: "npm:0.2.2" rxjs: "npm:7.8.2" tsx: "npm:4.23.13" @@ -3411,15 +3621,6 @@ __metadata: languageName: node linkType: hard -"prettier@npm:3.9.6": - version: 3.9.6 - resolution: "prettier@npm:3.9.6" - bin: - prettier: bin/prettier.cjs - checksum: 10c0/9f7ddae234035868f3daab3dc34e6de7e54622185afb017378029f0c09a9c023248ccf6f34def0b17a0538e18c47aa1b3188bab72965d1bf735919baa0747e99 - languageName: node - linkType: hard - "proc-log@npm:^6.0.0": version: 6.0.0 resolution: "proc-log@npm:6.0.0" @@ -3963,6 +4164,13 @@ __metadata: languageName: node linkType: hard +"tinypool@npm:2.1.2": + version: 2.1.2 + resolution: "tinypool@npm:2.1.2" + checksum: 10c0/4d8c0cf2d9710eff4aa9cb4318fecaac09d847f1d7dce3eb314d36bea35ed23f754315592a3c00c1d0aa21d9eb4a1f69e84c69feb8517b4cd769e1e0a7ee308e + languageName: node + linkType: hard + "tinyrainbow@npm:^3.1.1": version: 3.1.1 resolution: "tinyrainbow@npm:3.1.1"