From 907a2d8672ada2090ae66cfcec05e85426ffeb2e Mon Sep 17 00:00:00 2001 From: rory Date: Fri, 13 Nov 2026 17:57:29 -0800 Subject: [PATCH 1/2] chore: switch to oxfmt and lefthook --- .github/workflows/lint.yml | 6 +- .oxfmtrc.json | 10 + .prettierignore | 11 - .prettierrc.cjs | 9 - lefthook.yml | 13 + lib/OnyxUtils.ts | 2 +- package-lock.json | 560 ++++++++++++++++++++++++++++++++++++- package.json | 7 +- 8 files changed, 586 insertions(+), 32 deletions(-) create mode 100644 .oxfmtrc.json delete mode 100644 .prettierignore delete mode 100644 .prettierrc.cjs create mode 100644 lefthook.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9226ca617..4f47f57f1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,11 +25,11 @@ jobs: env: CI: true - - name: Verify there's no Prettier diff + - name: Verify there's no Oxfmt diff run: | - npm run prettier -- --loglevel silent + npm run fmt if ! git diff --name-only --exit-code; then # shellcheck disable=SC2016 - echo 'Error: Prettier diff detected! Please run `npm run prettier` and commit the changes.' + echo 'Error: Oxfmt diff detected! Please run `npm run fmt` and commit the changes.' exit 1 fi diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 000000000..384079f26 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,10 @@ +{ + "tabWidth": 4, + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": false, + "arrowParens": "always", + "printWidth": 190, + "singleAttributePerLine": true, + "ignorePatterns": [".github/actions/javascript/**/index.js", "dist/**", "package.json", "package-lock.json", "*.html", "*.yml", "*.yaml", "*.css", "*.scss", "*.md"] +} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 9f57e0b1a..000000000 --- a/.prettierignore +++ /dev/null @@ -1,11 +0,0 @@ -# The GH actions don't seem to compile and verify themselves well when Prettier is applied to them -.github/actions/javascript/**/index.js -dist -package.json -package-lock.json -*.html -*.yml -*.yaml -*.css -*.scss -*.md diff --git a/.prettierrc.cjs b/.prettierrc.cjs deleted file mode 100644 index ad1fafbb5..000000000 --- a/.prettierrc.cjs +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - tabWidth: 4, - singleQuote: true, - trailingComma: 'all', - bracketSpacing: false, - arrowParens: 'always', - printWidth: 190, - singleAttributePerLine: true, -}; diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 000000000..064c8d837 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,13 @@ +assert_lefthook_installed: true + +pre-commit: + commands: + oxfmt: + priority: 1 + glob: + - '*.{j,mj,cj}s' + - '*.{ts,tsx,mts,cts}' + - '*.json' + - '*.{yml,yaml}' + run: npx oxfmt --write --no-error-on-unmatched-pattern {staged_files} + stage_fixed: true diff --git a/lib/OnyxUtils.ts b/lib/OnyxUtils.ts index ed557f585..a1f97dcba 100644 --- a/lib/OnyxUtils.ts +++ b/lib/OnyxUtils.ts @@ -793,7 +793,7 @@ function prepareKeyValuePairsForStorage( continue; } - const valueWithoutNestedNullValues = shouldRemoveNestedNulls ?? true ? utils.removeNestedNullValues(value, cache.get(key)) : value; + const valueWithoutNestedNullValues = (shouldRemoveNestedNulls ?? true) ? utils.removeNestedNullValues(value, cache.get(key)) : value; if (valueWithoutNestedNullValues !== undefined) { pairs.push([key, valueWithoutNestedNullValues, replaceNullPatches?.[key]]); diff --git a/package-lock.json b/package-lock.json index 359c3c8f9..4b0862a1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,8 +55,9 @@ "jest-cli": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "jsdoc-to-markdown": "^7.1.0", + "lefthook": "2.1.9", "nodemon": "^3.0.3", - "prettier": "^2.8.8", + "oxfmt": "^0.55.0", "prop-types": "^15.7.2", "react": "18.2.0", "react-native": "0.76.3", @@ -3573,6 +3574,329 @@ "@octokit/openapi-types": "^24.2.0" } }, + "node_modules/@oxfmt/binding-android-arm-eabi": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.55.0.tgz", + "integrity": "sha512-+rFDOqQe5LOWgxrAJaZgLRudr6GQm0wGI6gtu7vVkrdLGjNMUSGbAlaCr8j7F2H2Er97vYQCU8WDb30onqMM1g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-android-arm64": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.55.0.tgz", + "integrity": "sha512-ctulLq8s3x8Zmvw6+iccB09TIKERAklRSmbJ10gk8mlAn05qZxoyo52dj3Hi9IJcmDSwF54fQaTVh2CbL6PInw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-arm64": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.55.0.tgz", + "integrity": "sha512-xDQczLH9pw/RBk1h/GH0qcGMm8hQtmtVHBNLSH3lk1gEIR09hZ4L+mJQl4VqiVAvPK9VG9PYrWWuSQLt7xTbiA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-x64": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.55.0.tgz", + "integrity": "sha512-JaNoFCkF2CJdGgpPSMbuO9HVyXyoNGIhMHPvp6NYAjeVKw9XEYc0HcUWJLPQa3Q69WV5wMa9m5jPMJPtbLtcRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-freebsd-x64": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.55.0.tgz", + "integrity": "sha512-DNbszhpg6S2MIzax5azdHFTTBIVkR5xr8yyRZuA4yoDAwOkzIp3tmldgKZM2+VlT+hJIG0xUksA+elISzMEAfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-gnueabihf": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.55.0.tgz", + "integrity": "sha512-2snoaoRfFFyGnbOcKUK36rREBYxe/Xgz3uHbiA5zbCB/s6R4DQj4mHqYAaWWhgizCUSDxV8cE9zAZ0XleNpKGw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-musleabihf": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.55.0.tgz", + "integrity": "sha512-q1aktHF/WRpSK81BX1dE/9vWrS2jGw1Nax2kb4DBLGAewubCLcoNyp4Zl/NSMgbv3vUS46Z33wIQkBVYOP3PYg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-gnu": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.55.0.tgz", + "integrity": "sha512-VD0y36aENezl/3tsclA/4G53Cc7iV+7Uoh7gz4yvcOTaEYBtJpQsE6PKDGTtUtOvGS4kv51ybfXY/nWZejO5IA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-musl": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.55.0.tgz", + "integrity": "sha512-r8xlKJFcsRmn0H5jZrdORae6RX9jDBrZVvOoxF+bCQtampQJClv80aZEHsv+NsLsp2KCE5ql79O7DpPVzYWpXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-ppc64-gnu": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.55.0.tgz", + "integrity": "sha512-GRKv/HXHcwIVld/WU61rF0g0R16hl5EJ+ScKdpjevT57lnLnagj/U2YUbXf2mT+2Pg1uCzWC+mvGicPV3CDdLQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-gnu": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.55.0.tgz", + "integrity": "sha512-rdv57enTiPtpSYRMKfAiEbQb0Puw5t9N7isVinDoo5qeLDScro2gznmZqSgSWbVZRzLisTeCTW8Qwgw0bOHv3A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-musl": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.55.0.tgz", + "integrity": "sha512-7v1nNrlD43VY6+sYQ6efYyb3lE6QY182304PD/768ZxTjOmFd/3dQa3u/nGBUAXYdGSWOQc5N3PnS0QzUXyEIA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-s390x-gnu": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.55.0.tgz", + "integrity": "sha512-f4lJLUSPOgScjFl9LiflKCTocyNRwE25JmTMbN4XQdDjoZzEHjqf3wA3VESF1/csg7i8m7+EQLbrZyYDqe10UQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-gnu": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.55.0.tgz", + "integrity": "sha512-MihqiPziJNoWy4MqNSV+jVA1g+07iQDjZiR0vaCaDoPgFEiJpCMsxamktzLV07cEeQsSJ04vQaU4CzCQwIvtDA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-musl": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.55.0.tgz", + "integrity": "sha512-Yqghym7KYAVjP9MmSrNZiDeerMuoejNjo0r3ox5H3GDKk8eAfl8VyJm9i+pWCLDCTnAbcTUMMN2ZKjUYXH1v3g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-openharmony-arm64": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.55.0.tgz", + "integrity": "sha512-s5SDvVVSbyQl1V5UU3Yl12M+XLUQ3rl5SglNqgAA2K4PXUtQhyNSS00wivONPEnNo5W01rCou8WkDNyvI/RGHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-arm64-msvc": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.55.0.tgz", + "integrity": "sha512-7p9FB5R32tw2KyyNX3wpQrR2WHwEHvMEiBlGXxeTCaRMCVNx3UtFMAUbaQ/pRNWIrEUZmYhJ6tcUH52uPTRYjQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-ia32-msvc": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.55.0.tgz", + "integrity": "sha512-ZYqj3fDnOT1IaVGMP5kpmkQl4F3tQIm2ZyAxvqkJYmI0xgWWak4ss4XYwv3VDfM+TWXeC9K4uQ/wW5jm/5XABA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-x64-msvc": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.55.0.tgz", + "integrity": "sha512-eEYT5tivGnGbPHuOHuQpi6CGLObhh0re/5jcNQHihD2GRYkTM85dyi5a19zjP8Q00t1uqAx+/QGLUGdHeqzWyg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, "node_modules/@react-native-community/eslint-config": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@react-native-community/eslint-config/-/eslint-config-3.2.0.tgz", @@ -11244,12 +11568,12 @@ "dev": true, "funding": [ { - "url": "https://github.com/sponsors/puzrin", - "type": "github" + "type": "github", + "url": "https://github.com/sponsors/puzrin" }, { - "url": "https://github.com/sponsors/nodeca", - "type": "github" + "type": "github", + "url": "https://github.com/sponsors/nodeca" } ], "license": "MIT", @@ -11653,6 +11977,169 @@ "node": ">=0.10" } }, + "node_modules/lefthook": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook/-/lefthook-2.1.9.tgz", + "integrity": "sha512-bwDaIOViTktE8kJLf9jP0p+H2/RDTlFFlc43Am2YgUsX22hI6Sq4RbzsrecwzY5y+MHTipOH7WsmWSEniePHWQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "lefthook": "bin/index.js" + }, + "optionalDependencies": { + "lefthook-darwin-arm64": "2.1.9", + "lefthook-darwin-x64": "2.1.9", + "lefthook-freebsd-arm64": "2.1.9", + "lefthook-freebsd-x64": "2.1.9", + "lefthook-linux-arm64": "2.1.9", + "lefthook-linux-x64": "2.1.9", + "lefthook-openbsd-arm64": "2.1.9", + "lefthook-openbsd-x64": "2.1.9", + "lefthook-windows-arm64": "2.1.9", + "lefthook-windows-x64": "2.1.9" + } + }, + "node_modules/lefthook-darwin-arm64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-darwin-arm64/-/lefthook-darwin-arm64-2.1.9.tgz", + "integrity": "sha512-119HryNcvr4nqn0wUIrNPgpMEPn9yMQzEcW/lezRsnb56PCJriJB92+MCySPVcWDxJnZef7o0T3jdnPNiSH7Qg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/lefthook-darwin-x64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-darwin-x64/-/lefthook-darwin-x64-2.1.9.tgz", + "integrity": "sha512-dwo5Tke2XcQCM56DGHgFKBfRbJIL6xs2wZ0zG1TUVZgl4t4mQUt6LiZ4V/ZQfYHTZF9qywvXoIlR5N35qOaiVQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/lefthook-freebsd-arm64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-2.1.9.tgz", + "integrity": "sha512-+09PVap6nl6xsaHch5JLtq7WvIR++U1Q2MzA2ai0M4uB/VP3AqrvKqHw6+9hjyKnIH+HHL83uqi77EAY+LaxLA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/lefthook-freebsd-x64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-x64/-/lefthook-freebsd-x64-2.1.9.tgz", + "integrity": "sha512-8XresjKIYpkE9ARgCtBEZgJZxAU3T4MIqzj4zNy15XRT59I1Us+QdqXTNm+pkZ41Yd2X/nxs2Pkvbq3NWWlIGw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/lefthook-linux-arm64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-linux-arm64/-/lefthook-linux-arm64-2.1.9.tgz", + "integrity": "sha512-1oNIQfwrPe6rgU2KcDM3aF6+hpZDCKx1TmawQKpXUY5gVsbZ7MqX0Sk/1lnnWxqPm+kQQ5f6J2dpFWd+4xH8jg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/lefthook-linux-x64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-linux-x64/-/lefthook-linux-x64-2.1.9.tgz", + "integrity": "sha512-fT+7Q+BJyGp+CslFQkNXmdFRgyVXsPHPi9NAsDX0a6QOyNnoORByAsvx6zeAKuF5rL3BBgNfho1/v2RuGxGy9w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/lefthook-openbsd-arm64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-openbsd-arm64/-/lefthook-openbsd-arm64-2.1.9.tgz", + "integrity": "sha512-4bVuafBk3dddVNo0+3hMbjcJs4mqYAstxpPMmX2ufkudSTYFNIhWoqwuGVQV/SS/xdcOKJAldW4qayAzed2ysw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/lefthook-openbsd-x64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-openbsd-x64/-/lefthook-openbsd-x64-2.1.9.tgz", + "integrity": "sha512-PmPoMmLP/wQQWcQ9u2YH86bTZ3UCfBsxuEmVTEyPU2U8R1qSTp5r/Gs3G8cN5Mxo91XB9oBERtF1n+xD3W6aVA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/lefthook-windows-arm64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-windows-arm64/-/lefthook-windows-arm64-2.1.9.tgz", + "integrity": "sha512-KphfkBKmwBnmolyrdhIl3lrBaOyTcCgXBT2AB/9OHnEXhOLvv5uTCUkrD4YRAxXPtFKq6UvnapIeoL3GZq0bdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/lefthook-windows-x64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/lefthook-windows-x64/-/lefthook-windows-x64-2.1.9.tgz", + "integrity": "sha512-2qlUtkJHZ3MyUxgV5XTEmcrIoNZA07iwaquoswAcqv/1MeBFXlD+O+koFRfrzWng2O5WYEbpJnd8tvaYnV8fTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -13138,6 +13625,58 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/oxfmt": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/oxfmt/-/oxfmt-0.55.0.tgz", + "integrity": "sha512-jSj2wCTakwgPMxkfiVZX0jf+nX+Nz6xlyAZjqNE0qXTFdCBPYlP6JAN+ODjmealw7DXBjOzYbdsqwBMAZnPZ6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinypool": "2.1.0" + }, + "bin": { + "oxfmt": "bin/oxfmt" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxfmt/binding-android-arm-eabi": "0.55.0", + "@oxfmt/binding-android-arm64": "0.55.0", + "@oxfmt/binding-darwin-arm64": "0.55.0", + "@oxfmt/binding-darwin-x64": "0.55.0", + "@oxfmt/binding-freebsd-x64": "0.55.0", + "@oxfmt/binding-linux-arm-gnueabihf": "0.55.0", + "@oxfmt/binding-linux-arm-musleabihf": "0.55.0", + "@oxfmt/binding-linux-arm64-gnu": "0.55.0", + "@oxfmt/binding-linux-arm64-musl": "0.55.0", + "@oxfmt/binding-linux-ppc64-gnu": "0.55.0", + "@oxfmt/binding-linux-riscv64-gnu": "0.55.0", + "@oxfmt/binding-linux-riscv64-musl": "0.55.0", + "@oxfmt/binding-linux-s390x-gnu": "0.55.0", + "@oxfmt/binding-linux-x64-gnu": "0.55.0", + "@oxfmt/binding-linux-x64-musl": "0.55.0", + "@oxfmt/binding-openharmony-arm64": "0.55.0", + "@oxfmt/binding-win32-arm64-msvc": "0.55.0", + "@oxfmt/binding-win32-ia32-msvc": "0.55.0", + "@oxfmt/binding-win32-x64-msvc": "0.55.0" + }, + "peerDependencies": { + "svelte": "^5.0.0", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + }, + "vite-plus": { + "optional": true + } + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -13501,6 +14040,7 @@ "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, "license": "MIT", + "peer": true, "bin": { "prettier": "bin-prettier.js" }, @@ -15730,6 +16270,16 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tinypool": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-2.1.0.tgz", + "integrity": "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.0.0 || >=22.0.0" + } + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", diff --git a/package.json b/package.json index 701164371..1b4ab23b3 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "prepare": "npm run build", + "prepare": "npm run build && lefthook install", "lint": "eslint .", "typecheck": "tsc --noEmit", "test": "jest", @@ -39,7 +39,7 @@ "prebuild:docs": "npm run build", "build:docs": "ts-node buildDocs.ts", "lint-tests": "eslint tests/**", - "prettier": "prettier --write .", + "fmt": "oxfmt --write .", "gh-actions-build": "./.github/scripts/buildActions.sh" }, "dependencies": { @@ -89,8 +89,9 @@ "jest-cli": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "jsdoc-to-markdown": "^7.1.0", + "lefthook": "2.1.9", "nodemon": "^3.0.3", - "prettier": "^2.8.8", + "oxfmt": "^0.55.0", "prop-types": "^15.7.2", "react": "18.2.0", "react-native": "0.76.3", From 5fbee8ba1f24eb34d8ffef42449df377b4589ef9 Mon Sep 17 00:00:00 2001 From: rory Date: Fri, 13 Nov 2026 18:06:16 -0800 Subject: [PATCH 2/2] style: format yaml with oxfmt --- .../actions/composite/setupNode/action.yml | 4 +- .../javascript/requireTests/action.yml | 4 +- .../javascript/validatePRChecklist/action.yml | 4 +- .../validateReassureOutput/action.yml | 22 ++++---- .github/workflows/cla.yml | 16 +++--- .github/workflows/lint.yml | 52 +++++++++---------- .github/workflows/pr-checklist.yml | 26 +++++----- .github/workflows/publish.yml | 18 +++---- .github/workflows/require-tests.yml | 30 +++++------ .github/workflows/test.yml | 48 ++++++++--------- .github/workflows/typecheck.yml | 38 +++++++------- .github/workflows/validateDocs.yml | 36 ++++++------- .github/workflows/validateGithubActions.yml | 36 ++++++------- .oxfmtrc.json | 10 +++- lefthook.yml | 20 +++---- 15 files changed, 186 insertions(+), 178 deletions(-) diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml index 490d7303f..b4a22ec59 100644 --- a/.github/actions/composite/setupNode/action.yml +++ b/.github/actions/composite/setupNode/action.yml @@ -3,7 +3,7 @@ description: Set up Node inputs: IS_HYBRID_BUILD: - description: "Indicates if node is set up for hybrid app" + description: 'Indicates if node is set up for hybrid app' required: false default: 'false' @@ -35,7 +35,7 @@ runs: key: ${{format('{0}-node-modules-{1}', runner.os, hashFiles('package-lock.json', 'patches/**'))}} - name: Install root project node packages - if: steps.cache-node-modules.outputs.cache-hit != 'true' + if: steps.cache-node-modules.outputs.cache-hit != 'true' uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847 with: timeout_minutes: 30 diff --git a/.github/actions/javascript/requireTests/action.yml b/.github/actions/javascript/requireTests/action.yml index bd0c9f318..856855cd4 100644 --- a/.github/actions/javascript/requireTests/action.yml +++ b/.github/actions/javascript/requireTests/action.yml @@ -1,5 +1,5 @@ name: 'Require Tests' description: 'Checks that PRs modifying source files in lib/ include corresponding test changes.' runs: - using: 'node24' - main: './index.js' + using: 'node24' + main: './index.js' diff --git a/.github/actions/javascript/validatePRChecklist/action.yml b/.github/actions/javascript/validatePRChecklist/action.yml index 3a30b4952..9fd7b5521 100644 --- a/.github/actions/javascript/validatePRChecklist/action.yml +++ b/.github/actions/javascript/validatePRChecklist/action.yml @@ -1,5 +1,5 @@ name: 'Validate PR Checklist' description: 'Validates that the PR description has a completed checklist and filled-in sections.' runs: - using: 'node24' - main: './index.js' + using: 'node24' + main: './index.js' diff --git a/.github/actions/javascript/validateReassureOutput/action.yml b/.github/actions/javascript/validateReassureOutput/action.yml index 755708ee4..d181c353f 100644 --- a/.github/actions/javascript/validateReassureOutput/action.yml +++ b/.github/actions/javascript/validateReassureOutput/action.yml @@ -1,15 +1,15 @@ name: 'Validate Regression Test Output' description: 'Validates the output of regression tests and determines if a test action should fail.' inputs: - ALLOWED_DURATION_DEVIATION: - description: Allowable deviation in milliseconds for the mean duration in regression test results. - required: true - ALLOWED_RELATIVE_DURATION_DEVIATION: - description: Allowable percentage deviation for the mean duration in regression test results. - required: true - IS_VALIDATING_STABILITY: - description: Whether the workflow is validating a Reassure stability check or not. - required: true + ALLOWED_DURATION_DEVIATION: + description: Allowable deviation in milliseconds for the mean duration in regression test results. + required: true + ALLOWED_RELATIVE_DURATION_DEVIATION: + description: Allowable percentage deviation for the mean duration in regression test results. + required: true + IS_VALIDATING_STABILITY: + description: Whether the workflow is validating a Reassure stability check or not. + required: true runs: - using: 'node24' - main: './index.js' + using: 'node24' + main: './index.js' diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 65425c4e6..57a9a5e8c 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -1,13 +1,13 @@ name: CLA Assistant on: - issue_comment: - types: [created] - pull_request_target: - types: [opened, synchronize] + issue_comment: + types: [created] + pull_request_target: + types: [opened, synchronize] jobs: - CLA: - cache-mode: read - uses: Expensify/GitHub-Actions/.github/workflows/cla.yml@main - secrets: inherit + CLA: + cache-mode: read + uses: Expensify/GitHub-Actions/.github/workflows/cla.yml@main + secrets: inherit diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4f47f57f1..cbb4e45b8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,35 +1,35 @@ name: Lint JavaScript on: - pull_request: - types: [opened, synchronize] + pull_request: + types: [opened, synchronize] jobs: - lint: - runs-on: ubuntu-latest - steps: - # v5.0.0 - - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 + lint: + runs-on: ubuntu-latest + steps: + # v5.0.0 + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 - - name: Setup Node - # v4 - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: package-lock.json + - name: Setup Node + # v4 + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e + with: + node-version-file: '.nvmrc' + cache: npm + cache-dependency-path: package-lock.json - - run: npm ci + - run: npm ci - - run: npm run lint - env: - CI: true + - run: npm run lint + env: + CI: true - - name: Verify there's no Oxfmt diff - run: | - npm run fmt - if ! git diff --name-only --exit-code; then - # shellcheck disable=SC2016 - echo 'Error: Oxfmt diff detected! Please run `npm run fmt` and commit the changes.' - exit 1 - fi + - name: Verify there's no Oxfmt diff + run: | + npm run fmt + if ! git diff --name-only --exit-code; then + # shellcheck disable=SC2016 + echo 'Error: Oxfmt diff detected! Please run `npm run fmt` and commit the changes.' + exit 1 + fi diff --git a/.github/workflows/pr-checklist.yml b/.github/workflows/pr-checklist.yml index 9913b21db..d3735e242 100644 --- a/.github/workflows/pr-checklist.yml +++ b/.github/workflows/pr-checklist.yml @@ -1,23 +1,23 @@ name: PR Checklist Validation on: - pull_request: - types: [opened, synchronize, edited, reopened, ready_for_review] + pull_request: + types: [opened, synchronize, edited, reopened, ready_for_review] permissions: - pull-requests: read + pull-requests: read concurrency: - group: pr-checklist-${{ github.event.pull_request.number }} - cancel-in-progress: true + group: pr-checklist-${{ github.event.pull_request.number }} + cancel-in-progress: true jobs: - validate-checklist: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - # v5.0.0 - - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 + validate-checklist: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + # v5.0.0 + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 - - name: Validate PR checklist and sections - uses: ./.github/actions/javascript/validatePRChecklist + - name: Validate PR checklist and sections + uses: ./.github/actions/javascript/validatePRChecklist diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 39a442043..4ceea4df4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,8 @@ name: Publish package to npmjs on: - push: - branches: [main] + push: + branches: [main] permissions: # Required for OIDC: https://docs.npmjs.com/trusted-publishers @@ -14,10 +14,10 @@ permissions: concurrency: ${{ github.workflow }} jobs: - publish: - # os-botify[bot] will update the version on `main`, so this check is important to prevent an infinite loop - if: ${{ github.actor != 'os-botify[bot]' }} - uses: Expensify/GitHub-Actions/.github/workflows/npmPublish.yml@main - secrets: inherit - with: - should_run_build: true + publish: + # os-botify[bot] will update the version on `main`, so this check is important to prevent an infinite loop + if: ${{ github.actor != 'os-botify[bot]' }} + uses: Expensify/GitHub-Actions/.github/workflows/npmPublish.yml@main + secrets: inherit + with: + should_run_build: true diff --git a/.github/workflows/require-tests.yml b/.github/workflows/require-tests.yml index 223d06322..98521fa6b 100644 --- a/.github/workflows/require-tests.yml +++ b/.github/workflows/require-tests.yml @@ -1,25 +1,25 @@ name: Require Tests on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] + pull_request: + types: [opened, synchronize, reopened, ready_for_review] permissions: - pull-requests: read + pull-requests: read concurrency: - group: require-tests-${{ github.event.pull_request.number }} - cancel-in-progress: true + group: require-tests-${{ github.event.pull_request.number }} + cancel-in-progress: true jobs: - require-tests: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - # v5.0.0 - - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 + require-tests: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + # v5.0.0 + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 - - name: Check for test file changes - uses: ./.github/actions/javascript/requireTests - env: - GITHUB_TOKEN: ${{ github.token }} + - name: Check for test file changes + uses: ./.github/actions/javascript/requireTests + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de38cf64a..458584239 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,34 +1,34 @@ name: Test JavaScript on: - pull_request: - types: [opened, synchronize] + pull_request: + types: [opened, synchronize] jobs: - test: - runs-on: ubuntu-latest - steps: - # v5.0.0 - - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 + test: + runs-on: ubuntu-latest + steps: + # v5.0.0 + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 - # 4.3.0 - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + # 4.3.0 + - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - - name: Setup Node - # v4 - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e - with: - node-version-file: ".nvmrc" + - name: Setup Node + # v4 + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e + with: + node-version-file: '.nvmrc' - - run: npm ci + - run: npm ci - - run: npm run test - env: - CI: true + - run: npm run test + env: + CI: true - - run: npm run test:types \ No newline at end of file + - run: npm run test:types diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 79bb01d6f..c4287b0b9 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -1,27 +1,27 @@ name: TypeScript Checks on: - pull_request: - types: [opened, synchronize] + pull_request: + types: [opened, synchronize] jobs: - typecheck: - runs-on: ubuntu-latest - steps: - # v5.0.0 - - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 + typecheck: + runs-on: ubuntu-latest + steps: + # v5.0.0 + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 - - name: Setup Node - # v4 - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: package-lock.json + - name: Setup Node + # v4 + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e + with: + node-version-file: '.nvmrc' + cache: npm + cache-dependency-path: package-lock.json - - run: npm ci + - run: npm ci - - name: Type check with TypeScript - run: npm run typecheck - env: - CI: true + - name: Type check with TypeScript + run: npm run typecheck + env: + CI: true diff --git a/.github/workflows/validateDocs.yml b/.github/workflows/validateDocs.yml index 43fdf9630..bbd7f00e5 100644 --- a/.github/workflows/validateDocs.yml +++ b/.github/workflows/validateDocs.yml @@ -1,26 +1,26 @@ name: Validate API Docs on: - pull_request: - types: [opened, synchronize] - paths: ['lib/**', 'buildDocs.ts', 'API.md', 'API-INTERNAL.md', '.github/workflows/validateDocs.yml', '.github/scripts/verifyDocs.sh'] + pull_request: + types: [opened, synchronize] + paths: ['lib/**', 'buildDocs.ts', 'API.md', 'API-INTERNAL.md', '.github/workflows/validateDocs.yml', '.github/scripts/verifyDocs.sh'] jobs: - verify: - runs-on: ubuntu-latest - steps: - # v5.0.0 - - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 + verify: + runs-on: ubuntu-latest + steps: + # v5.0.0 + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 - - name: Setup Node - # v4.4.0 - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: package-lock.json + - name: Setup Node + # v4.4.0 + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e + with: + node-version-file: '.nvmrc' + cache: npm + cache-dependency-path: package-lock.json - - run: npm ci + - run: npm ci - - name: Verify API Docs Are Up To Date - run: ./.github/scripts/verifyDocs.sh + - name: Verify API Docs Are Up To Date + run: ./.github/scripts/verifyDocs.sh diff --git a/.github/workflows/validateGithubActions.yml b/.github/workflows/validateGithubActions.yml index aaf9df052..6a51c4939 100644 --- a/.github/workflows/validateGithubActions.yml +++ b/.github/workflows/validateGithubActions.yml @@ -1,26 +1,26 @@ name: Validate Github Actions on: - pull_request: - types: [opened, synchronize] - paths: ['.github/**'] + pull_request: + types: [opened, synchronize] + paths: ['.github/**'] jobs: - verify: - runs-on: ubuntu-latest - steps: - # v5.0.0 - - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 + verify: + runs-on: ubuntu-latest + steps: + # v5.0.0 + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 - - name: Setup Node - # v4.4.0 - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: package-lock.json + - name: Setup Node + # v4.4.0 + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e + with: + node-version-file: '.nvmrc' + cache: npm + cache-dependency-path: package-lock.json - - run: npm ci + - run: npm ci - - name: Verify Javascript Action Builds - run: ./.github/scripts/verifyActions.sh + - name: Verify Javascript Action Builds + run: ./.github/scripts/verifyActions.sh diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 384079f26..5ee8a6e9d 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -6,5 +6,13 @@ "arrowParens": "always", "printWidth": 190, "singleAttributePerLine": true, - "ignorePatterns": [".github/actions/javascript/**/index.js", "dist/**", "package.json", "package-lock.json", "*.html", "*.yml", "*.yaml", "*.css", "*.scss", "*.md"] + "ignorePatterns": [".github/actions/javascript/**/index.js", "dist/**", "package.json", "package-lock.json", "*.html", "*.css", "*.scss", "*.md"], + "overrides": [ + { + "files": ["*.yml", "*.yaml"], + "options": { + "tabWidth": 2 + } + } + ] } diff --git a/lefthook.yml b/lefthook.yml index 064c8d837..5b0487f28 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,13 +1,13 @@ assert_lefthook_installed: true pre-commit: - commands: - oxfmt: - priority: 1 - glob: - - '*.{j,mj,cj}s' - - '*.{ts,tsx,mts,cts}' - - '*.json' - - '*.{yml,yaml}' - run: npx oxfmt --write --no-error-on-unmatched-pattern {staged_files} - stage_fixed: true + commands: + oxfmt: + priority: 1 + glob: + - '*.{j,mj,cj}s' + - '*.{ts,tsx,mts,cts}' + - '*.json' + - '*.{yml,yaml}' + run: npx oxfmt --write --no-error-on-unmatched-pattern {staged_files} + stage_fixed: true