Skip to content

Commit 458f5c2

Browse files
committed
chore: switch to oxfmt
1 parent 78e5237 commit 458f5c2

12 files changed

Lines changed: 264 additions & 501 deletions

File tree

.oxfmtrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"semi": false,
4+
"tabWidth": 4,
5+
"trailingComma": "all",
6+
"printWidth": 80,
7+
"sortPackageJson": false,
8+
"ignorePatterns": [
9+
"node_modules",
10+
"userdata",
11+
"build",
12+
"contractSessions",
13+
"chunk*.js",
14+
"webui/dist",
15+
"*.plugin.js",
16+
"*Plugin.js",
17+
"components/contracts.json",
18+
"logs",
19+
"resources/**/*.json",
20+
"!resources/locale.json",
21+
"packaging/add_itemsize/*",
22+
"!packaging/add_itemsize/add_itemsize.js"
23+
]
24+
}

.prettierignore

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

components/contracts/hitsCategoryService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ export class HitsCategoryService {
471471
case "completed":
472472
return Boolean(
473473
played[contractId]?.Completed &&
474-
!played[contractId]?.IsEscalation,
474+
!played[contractId]?.IsEscalation,
475475
)
476476
case "failed":
477477
return (

components/menus/menuSystem.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,7 @@ export class MenuSystemDatabase {
406406
$datacontext: {
407407
in: "$.",
408408
datavalues: {
409-
AutoStart:
410-
false,
409+
AutoStart: false,
411410
},
412411
do: {
413412
$include: {

components/statemachines/contextListeners.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ export type Toggle = IContextListener<"toggle">
7171
/**
7272
* Used to count things during a challenge.
7373
*/
74-
export interface ObjectiveCounter
75-
extends IContextListener<"objective-counter"> {
74+
export interface ObjectiveCounter extends IContextListener<"objective-counter"> {
7675
/**
7776
* Locale string for the HUD display.
7877
*/

components/types/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ export interface RequestWithJwt<
128128
RequestBody = any,
129129
Params = core.ParamsDictionary,
130130
> extends Request<
131-
Params,
132-
// eslint-disable-next-line
133-
any,
134-
RequestBody,
135-
core.Query & Query
136-
> {
131+
Params,
132+
// eslint-disable-next-line
133+
any,
134+
RequestBody,
135+
core.Query & Query
136+
> {
137137
/**
138138
* The user's JSON Web Token (JWT) data.
139139
*/

package.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"scripts": {
77
"start": "node chunk0.js",
88
"clean": "premove build",
9-
"prettier": "pprettier --write \"**/*.{js,json,ts,md,tsx,css,mjs,html}\"",
10-
"prettier:check": "pprettier --check \"**/*.{js,json,ts,md,tsx,css,mjs,html}\"",
9+
"prettier": "oxfmt --write \"**/*.{js,json,ts,md,tsx,css,mjs,html}\"",
10+
"prettier:check": "oxfmt --check \"**/*.{js,json,ts,md,tsx,css,mjs,html}\"",
1111
"build": "yarn webui:build && node packaging/build.mjs",
1212
"build-plugins": "node --no-warnings packaging/buildPlugins.mjs",
1313
"typecheck-ws": "tsc",
@@ -22,11 +22,6 @@
2222
"extract-featured-contracts": "node packaging/extractFeaturedContracts.mjs",
2323
"find-circular": "yarn dlx dpdm components/index.ts --exclude \"(components/types)|(node_modules)\" -T"
2424
},
25-
"prettier": {
26-
"semi": false,
27-
"tabWidth": 4,
28-
"trailingComma": "all"
29-
},
3025
"resolutions": {
3126
"debug": "^4.3.4",
3227
"iconv-lite": "^0.6.3",
@@ -76,7 +71,6 @@
7671
"@eslint/eslintrc": "^3.1.0",
7772
"@eslint/js": "^9.4.0",
7873
"@peacockproject/eslint-plugin": "workspace:*",
79-
"@rdil/parallel-prettier": "^3.0.0",
8074
"@types/express": "^5.0.0",
8175
"@types/jsonwebtoken": "^9.0.9",
8276
"@types/node": "^22.13.10",
@@ -90,15 +84,14 @@
9084
"esbuild": "^0.25.0",
9185
"esbuild-register": "^3.6.0",
9286
"eslint": "^9.22.0",
93-
"eslint-config-prettier": "^10.1.1",
9487
"eslint-plugin-promise": "^7.2.1",
9588
"eslint-plugin-react-hooks": "^5.2.0",
9689
"fast-glob": "^3.3.3",
9790
"globals": "^16.0.0",
9891
"json-keys-sort": "^2.1.0",
9992
"ms": "^2.1.3",
93+
"oxfmt": "^0.42.0",
10094
"premove": "^4.0.0",
101-
"prettier": "^3.5.3",
10295
"terser": "^5.39.0",
10396
"typescript": "5.8.2",
10497
"winston": "3.13.0",

packaging/buildTasks.mjs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { mkdir, readdir, readFile, unlink, writeFile } from "fs/promises"
2323
import { createHash } from "crypto"
2424
import { Packr } from "msgpackr"
2525
import glob from "fast-glob"
26-
import prettier from "prettier"
26+
import { format } from "oxfmt"
2727

2828
const packer = new Packr({
2929
bundleStrings: true,
@@ -73,15 +73,18 @@ export async function generateRequireTable() {
7373
requiresTable.push(`"@peacockproject/core/${importPath}": ${variable}`)
7474
}
7575

76-
const prettierConfig = {
77-
parser: "babel",
76+
const formatConfig = {
7877
semi: false,
7978
tabWidth: 4,
8079
trailingComma: "all",
80+
printWidth: 80,
8181
}
8282

83+
const fileName = "components/generatedPeacockRequireTable.ts"
84+
8385
// language=TypeScript
84-
const generatedPeacockRequireTableFile = await prettier.format(
86+
const result = await format(
87+
fileName,
8588
`/*
8689
* The Peacock Project - a HITMAN server replacement.
8790
* Copyright (C) 2021-2026 The Peacock Project Team
@@ -105,13 +108,10 @@ export async function generateRequireTable() {
105108
export default {
106109
${requiresTable.join(",\n")}
107110
}`,
108-
prettierConfig,
111+
formatConfig,
109112
)
110113

111-
await writeFile(
112-
"components/generatedPeacockRequireTable.ts",
113-
generatedPeacockRequireTableFile,
114-
)
114+
await writeFile(fileName, result.code)
115115
}
116116

117117
export async function packResources() {

webui/src/LoadoutsForGameVersion.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ export function LoadoutsForGameVersion({
5151
return <p>Loading...</p>
5252
}
5353

54-
// note: putting these 2 consts together make intellij and prettier conflict each other
5554
const theGameVer = data[`h${gameVersion}`] as LoadoutsGameVersion
56-
5755
const loadoutsForVersion: Loadout[] = theGameVer.loadouts
5856

5957
return (

webui/src/pages/EscalationLevelPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export function EscalationLevelPage() {
6060

6161
const isReadyToSelectUser = Boolean(
6262
user === undefined &&
63-
userData &&
64-
(userData as { error: string } & BasicUser[])?.error !== "bad gv",
63+
userData &&
64+
(userData as { error: string } & BasicUser[])?.error !== "bad gv",
6565
)
6666

6767
function getStatus(): string {

0 commit comments

Comments
 (0)