Skip to content

Commit 8b7c9bd

Browse files
committed
chore: switch to oxfmt, oxlint - add ci checks
1 parent 4e919e7 commit 8b7c9bd

14 files changed

Lines changed: 594 additions & 1477 deletions

.eslintignore

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

.github/workflows/code-quality.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: "🎨 Format & Lint"
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
code-quality:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: ⬇️ Checkout repo
15+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
with:
17+
fetch-depth: 0
18+
persist-credentials: false
19+
20+
- name: ⎔ Setup pnpm
21+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
22+
with:
23+
version: 10.33.2
24+
25+
- name: ⎔ Setup node
26+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
27+
with:
28+
node-version: 20.20.2
29+
cache: "pnpm"
30+
31+
- name: 📥 Download deps
32+
run: pnpm install --frozen-lockfile
33+
34+
# Gate only on files this PR adds/modifies (ratchet) — the repo is not
35+
# fully formatted/linted yet, so a whole-repo check would fail every PR.
36+
- name: 🔍 Determine changed files
37+
id: changes
38+
env:
39+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
40+
run: |
41+
FILES=$(git diff --name-only --diff-filter=ACMR "$BASE_SHA"...HEAD -- \
42+
'*.ts' '*.tsx' '*.js' '*.jsx' '*.mjs' '*.cjs')
43+
echo "Changed code files:"
44+
echo "${FILES:-<none>}"
45+
{
46+
echo "files<<EOF"
47+
echo "$FILES"
48+
echo "EOF"
49+
} >> "$GITHUB_OUTPUT"
50+
if [ -z "$FILES" ]; then
51+
echo "has_files=false" >> "$GITHUB_OUTPUT"
52+
else
53+
echo "has_files=true" >> "$GITHUB_OUTPUT"
54+
fi
55+
56+
# TODO enable format check for ALL code
57+
- name: 💅 Check formatting
58+
if: steps.changes.outputs.has_files == 'true'
59+
env:
60+
FILES: ${{ steps.changes.outputs.files }}
61+
# Unquoted $FILES intentionally word-splits the newline-separated list
62+
# into separate path args. Safe given the has_files guard above.
63+
run: pnpm exec oxfmt --check $FILES
64+
65+
# TODO update this so lint failures fail CI
66+
# Informational only — lint findings are surfaced in the logs but never
67+
# fail the job. Only the formatting check above blocks the PR.
68+
- name: 🔎 Lint (informational, non-blocking)
69+
if: steps.changes.outputs.has_files == 'true'
70+
continue-on-error: true
71+
env:
72+
FILES: ${{ steps.changes.outputs.files }}
73+
run: pnpm exec oxlint $FILES

.github/workflows/pr_checks.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ jobs:
102102
- 'pnpm-workspace.yaml'
103103
- 'turbo.json'
104104
105+
code-quality:
106+
needs: changes
107+
if: needs.changes.outputs.code == 'true'
108+
uses: ./.github/workflows/code-quality.yml
109+
105110
typecheck:
106111
needs: changes
107112
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.typecheck_self == 'true'
@@ -155,6 +160,7 @@ jobs:
155160
name: All PR Checks
156161
needs:
157162
- changes
163+
- code-quality
158164
- typecheck
159165
- webapp
160166
- e2e-webapp

.oxfmtrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"semi": true,
4+
"singleQuote": false,
5+
"jsxSingleQuote": false,
6+
"trailingComma": "es5",
7+
"bracketSpacing": true,
8+
"bracketSameLine": false,
9+
"printWidth": 100,
10+
"tabWidth": 2,
11+
"useTabs": false,
12+
"sortPackageJson": false,
13+
"ignorePatterns": [
14+
"node_modules",
15+
".env",
16+
".env.local",
17+
"pnpm-lock.yaml",
18+
"tailwind.css",
19+
".babelrc.json",
20+
"**/.react-email/",
21+
"**/storybook-static/",
22+
"**/.changeset/",
23+
"**/dist/",
24+
]
25+
}

.oxlintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["typescript", "import", "react"],
4+
"ignorePatterns": [
5+
"**/dist/**",
6+
"**/build/**",
7+
"**/*.d.ts",
8+
"**/seed.js",
9+
"**/seedCloud.ts",
10+
"**/populate.js"
11+
],
12+
"rules": {
13+
"consistent-type-imports": [
14+
"warn",
15+
{
16+
"prefer": "type-imports",
17+
"disallowTypeAnnotations": true,
18+
"fixStyle": "inline-type-imports"
19+
}
20+
],
21+
"import/no-duplicates": ["warn", { "prefer-inline": true }],
22+
"react-hooks/rules-of-hooks": "error"
23+
}
24+
}

.prettierignore

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

apps/webapp/.eslintrc

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

apps/webapp/.prettierignore

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

apps/webapp/package.json

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"build:sentry": "esbuild --platform=node --format=cjs --outbase=. ./sentry.server.ts ./app/utils/sentryTraceContext.server.ts --outdir=build --sourcemap",
1111
"dev": "cross-env PORT=3030 remix dev -c \"node ./build/server.js\"",
1212
"dev:worker": "cross-env NODE_PATH=../../node_modules/.pnpm/node_modules node ./build/server.js",
13-
"format": "prettier --write .",
14-
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
13+
"format": "oxfmt .",
14+
"lint": "oxlint -c ../../.oxlintrc.json",
1515
"start": "cross-env NODE_ENV=production node --max-old-space-size=8192 ./build/server.js",
1616
"start:local": "cross-env node --max-old-space-size=8192 ./build/server.js",
1717
"typecheck": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" tsc --noEmit -p ./tsconfig.check.json",
@@ -21,11 +21,6 @@
2121
"test": "vitest --no-file-parallelism",
2222
"eval:dev": "evalite watch"
2323
},
24-
"eslintIgnore": [
25-
"/node_modules",
26-
"/build",
27-
"/public/build"
28-
],
2924
"dependencies": {
3025
"@ai-sdk/openai": "^3.0.0",
3126
"@ai-sdk/react": "^3.0.0",
@@ -242,7 +237,6 @@
242237
"@internal/replication": "workspace:*",
243238
"@internal/testcontainers": "workspace:*",
244239
"@remix-run/dev": "2.17.4",
245-
"@remix-run/eslint-config": "2.17.4",
246240
"@remix-run/testing": "^2.17.4",
247241
"@sentry/cli": "2.50.2",
248242
"@swc/core": "^1.3.4",
@@ -253,7 +247,6 @@
253247
"@types/bcryptjs": "^2.4.2",
254248
"@types/compression": "^1.7.2",
255249
"@types/cookie": "^0.6.0",
256-
"@types/eslint": "^8.4.6",
257250
"@types/express": "^4.17.13",
258251
"@types/humanize-duration": "^3.27.1",
259252
"@types/json-query": "^2.2.3",
@@ -274,19 +267,12 @@
274267
"@types/supertest": "^6.0.2",
275268
"@types/tar": "^6.1.4",
276269
"@types/ws": "^8.5.3",
277-
"@typescript-eslint/eslint-plugin": "^5.59.6",
278-
"@typescript-eslint/parser": "^5.59.6",
279270
"autoevals": "^0.0.130",
280271
"autoprefixer": "^10.4.13",
281272
"css-loader": "^6.10.0",
282273
"datepicker": "link:@types/@react-aria/datepicker",
283274
"engine.io": "^6.5.4",
284275
"esbuild": "^0.15.10",
285-
"eslint": "^8.24.0",
286-
"eslint-config-prettier": "^8.5.0",
287-
"eslint-plugin-import": "^2.29.1",
288-
"eslint-plugin-react-hooks": "^4.6.2",
289-
"eslint-plugin-turbo": "^2.0.4",
290276
"evalite": "1.0.0-beta.16",
291277
"npm-run-all": "^4.1.5",
292278
"postcss-import": "^16.0.1",

apps/webapp/prettier.config.js

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

0 commit comments

Comments
 (0)