Skip to content

Commit 3e996b6

Browse files
authored
chore: Switch from prettier to oxfmt (#260)
* Only actual change from moving to oxfmt is the utilities.ts, which would've changed with prettier 3.7 as well apparently. * Bump lockfile. * Change to `oxfmt .` in the lint-staged command instead of just `--check`, so it can auto-format the code. * Add a description ot the version input. This is required by the schema for github actions YML files, so it was angering my editor.
1 parent d97c574 commit 3e996b6

File tree

9 files changed

+134
-56
lines changed

9 files changed

+134
-56
lines changed

.github/workflows/bump_oxlint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7+
description: 'The version of oxlint to bump to'
78
required: true
89
type: string
910

@@ -30,7 +31,7 @@ jobs:
3031
run: |
3132
pnpm install oxlint@${OXLINT_VERSION}
3233
pnpm run generate # Generate rules
33-
pnpm run format # run prettier over it
34+
pnpm run format # run oxfmt over it
3435
3536
- name: Test and update snapshot
3637
continue-on-error: true # we check in PR why it fails

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
- name: Run oxlint
2424
run: npx oxlint --type-aware
2525

26-
- name: Run Format (prettier)
27-
run: npx prettier . --check
26+
- name: Run Format (oxfmt)
27+
run: npx oxfmt . --check
2828

2929
- name: Type Check
3030
run: npx tsc --noEmit

.oxfmtrc.jsonc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"printWidth": 80
7+
}

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"recommendations": [
33
"dbaeumer.vscode-eslint",
4-
"esbenp.prettier-vscode",
54
"oxc.oxc-vscode",
65
"vitest.explorer"
76
]

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"source.organizeImports": "never"
99
},
1010
"oxc.typeAware": true,
11-
"editor.defaultFormatter": "esbenp.prettier-vscode"
11+
"editor.defaultFormatter": "oxc.oxc-vscode"
1212
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"scripts": {
1818
"prepare": "husky",
1919
"generate": "node --import @oxc-node/core/register ./scripts/generate.ts",
20-
"format": "npx prettier --write .",
20+
"format": "oxfmt",
2121
"type-check": "tsc --noEmit",
2222
"lint": "oxlint --type-aware",
2323
"test": "vitest",
@@ -69,17 +69,17 @@
6969
"jiti": "^2.4.2",
7070
"lint-staged": "^16.1.2",
7171
"next": "^16.0.0",
72+
"oxfmt": "^0.15.0",
7273
"oxlint": "^1.30.0",
73-
"oxlint-tsgolint": "^0.8.0",
74-
"prettier": "^3.6.1",
74+
"oxlint-tsgolint": "^0.8.3",
7575
"typescript": "^5.8.3",
7676
"typescript-eslint": "^8.35.0",
7777
"vite": "^7.0.0",
7878
"vite-plugin-dts": "^4.5.4",
7979
"vitest": "^4.0.0"
8080
},
8181
"lint-staged": {
82-
"*": "prettier --ignore-unknown --write"
82+
"*": "oxfmt ."
8383
},
8484
"dependencies": {
8585
"commander": "^14.0.0",

pnpm-lock.yaml

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

prettier.config.js

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

src/utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const isEqualDeep = <T>(a: T, b: T): boolean => {
99

1010
return Boolean(
1111
bothAreObjects &&
12-
Object.keys(a).length === Object.keys(b).length &&
13-
Object.entries(a).every(([k, v]) => isEqualDeep(v, b[k as keyof T]))
12+
Object.keys(a).length === Object.keys(b).length &&
13+
Object.entries(a).every(([k, v]) => isEqualDeep(v, b[k as keyof T]))
1414
);
1515
};

0 commit comments

Comments
 (0)