Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(dx): add prettier to CI (#7735)

Nimar5920f3a6c711
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index d1439a1a1a..b6950e38b3 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -52,6 +52,49 @@ jobs:
- name: lint web
run: pnpm run lint
+ prettier-check:
+ runs-on: ubuntu-latest
+ needs:
+ - pre-job
+ if: needs.pre-job.outputs.should_skip != 'true'
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - uses: pnpm/action-setup@v3
+ with:
+ version: 9.5.0
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: "pnpm"
+ cache-dependency-path: "pnpm-lock.yaml"
+ - name: install dependencies
+ run: |
+ pnpm i
+ - name: Load default env
+ run: |
+ cp .env.dev.example .env
+ - name: Check formatting on changed files
+ run: |
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
+ BASE_SHA=${{ github.event.pull_request.base.sha }}
+ else
+ BASE_SHA=$(git merge-base origin/main HEAD)
+ fi
+
+ echo "Checking files changed from $BASE_SHA to HEAD"
+
+ # Get changed files
+ CHANGED_FILES=$(git diff --name-only $BASE_SHA HEAD -- '*.js' '*.jsx' '*.ts' '*.tsx' '*.css' | tr '\n' ' ')
+
+ if [ -n "$CHANGED_FILES" ] && [ "$CHANGED_FILES" != " " ]; then
+ echo "Files to check: $CHANGED_FILES"
+ pnpm prettier --check --experimental-cli $CHANGED_FILES
+ else
+ echo "No JS/TS/CSS files changed - skipping prettier check"
+ fi
+
test-docker-build:
timeout-minutes: 20
runs-on: ubuntu-latest
@@ -430,6 +473,7 @@ jobs:
needs:
[
lint,
+ prettier-check,
tests-web-sync,
tests-worker,
e2e-tests,
diff --git a/.husky/pre-commit b/.husky/pre-commit
index 46d7f4e4eb..f5554fd4c0 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -11,15 +11,13 @@ if [ "$current_branch" = "$protected_branch" ]; then
echo "🚨 You are about to commit to the $protected_branch branch. Are you sure? (y/n)"
read -r answer < /dev/tty
if [ "$answer" != "${answer#[Yy]}" ]; then
- # Commit approved, run formatting
- pnpm run format-fast
- exit 0 # Commit will proceed
+ # Commit approved, check formatting. On files changed, block commit
+ pnpm run format:check
else
echo "Commit to $protected_branch branch has been canceled."
exit 1 # Commit will be blocked
fi
fi
-# If not the protected branch, run formatting and proceed with the commit
-pnpm run format-fast
-exit 0
+# If not the protected branch, check formatting (on changed files, block)
+pnpm run format:check
diff --git a/package.json b/package.json
index 8e24ce36b1..6fba609c42 100644
--- a/package.json
+++ b/package.json
@@ -27,8 +27,8 @@
"dev:web": "turbo run dev --filter=web",
"dev:web-turbo": "turbo run dev --filter=web -- --turbo",
"lint": "turbo run lint",
- "format": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
- "format-fast": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\" --experimental-cli",
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\" --experimental-cli",
+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,css}\" --experimental-cli",
"test": "turbo run test",
"release": "dotenv -e ../.env -- release-it",
"prepare": "husky"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index cd930e9c04..7b57dc04b8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -60,7 +60,7 @@ importers:
next-auth:
specifier: ^4.24.11
zod:
specifier: ^3.25.62
version: 3.25.62
@@ -234,7 +234,7 @@ importers:
version: 4.1.1
next-auth:
specifier: ^4.24.11
nodemailer:
specifier: ^6.9.15
version: 6.9.15
@@ -634,7 +634,7 @@ importers:
next-auth:
specifier: ^4.24.11
next-query-params:
specifier: ^5.0.1
@@ -6927,15 +6927,6 @@ packages:
supports-color:
optional: true
- resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==}
- engines: {node: '>=6.0'}
- peerDependencies:
- supports-color: '*'
- peerDependenciesMeta:
- supports-color:
- optional: true
-
resolution: {integrity: sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==}
engines: {node: '>=6.0'}
@@ -13446,7 +13437,7 @@ snapshots:
'@babel/traverse': 7.24.1
'@babel/types': 7.24.0
convert-source-map: 2.0.0
- debug: 4.3.7([email protected])
+ debug: 4.4.1
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@@ -13676,7 +13667,7 @@ snapshots:
'@babel/helper-split-export-declaration': 7.22.6
'@babel/parser': 7.24.1
'@babel/types': 7.24.0
- debug: 4.3.7([email protected])
+ debug: 4.4.1
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@@ -14186,7 +14177,7 @@ snapshots:
'@eslint/[email protected]':
dependencies:
ajv: 6.12.6
- debug: 4.3.7([email protected])
+ debug: 4.4.1
espree: 9.6.1
globals: 13.24.0
ignore: 5.3.1
@@ -14344,7 +14335,7 @@ snapshots:
'@humanwhocodes/[email protected]':
dependencies:
'@humanwhocodes/object-schema': 2.0.2
- debug: 4.3.7([email protected])
+ debug: 4.4.1
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
@@ -15064,7 +15055,7 @@ snapshots:
dependencies:
'@next/[email protected]': {}
@@ -18199,7 +18190,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 6.21.0([email protected])
'@typescript-eslint/utils': 6.21.0([email protected])([email protected])
- debug: 4.3.7([email protected])
+ debug: 4.4.1
eslint: 8.57.0
ts-api-utils: 1.3.0([email protected])
optionalDependencies:
@@ -18211,7 +18202,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 7.3.1([email protected])
'@typescript-eslint/utils': 7.3.1([email protected])([email protected])
- debug: 4.3.7([email protected])
+ debug: 4.4.1
eslint: 8.57.0
ts-api-utils: 1.3.0([email protected])
optionalDependencies:
@@ -18245,7 +18236,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 6.21.0
'@typescript-eslint/visitor-keys': 6.21.0
- debug: 4.4.0
+ debug: 4.4.1
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.3
@@ -18260,7 +18251,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 7.12.0
'@typescript-eslint/visitor-keys': 7.12.0
- debug: 4.3.7([email protected])
+ debug: 4.4.1
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.5
@@ -18275,7 +18266,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 7.3.1
'@typescript-eslint/visitor-keys': 7.3.1
- debug: 4.3.7([email protected])
+ debug: 4.4.1
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.3
@@ -18392,7 +18383,7 @@ snapshots:
'@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
'@typescript-eslint/parser': 7.12.0([email protected])([email protected])
eslint-config-prettier: 9.1.0([email protected])
- eslint-import-resolver-alias: 1.1.2([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
eslint-plugin-eslint-comments: 3.2.0([email protected])
@@ -19896,15 +19887,15 @@ snapshots:
dependencies:
ms: 2.1.2
dependencies:
ms: 2.1.3
- optionalDependencies:
- supports-color: 5.5.0
dependencies:
ms: 2.1.3
+ optionalDependencies:
+ supports-color: 5.5.0
dependencies:
@@ -20383,7 +20374,7 @@ snapshots:
eslint-plugin-turbo: 2.5.4([email protected])([email protected])
turbo: 2.5.4
dependencies:
@@ -20397,7 +20388,7 @@ snapshots:
dependencies:
- debug: 4.3.7([email protected])
+ debug: 4.4.1
enhanced-resolve: 5.17.1
eslint: 8.57.0
@@ -20414,7 +20405,7 @@ snapshots:
dependencies:
- debug: 4.3.7([email protected])
+ debug: 4.4.1
enhanced-resolve: 5.17.1
eslint: 8.57.0
@@ -20474,7 +20465,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.15.1
is-glob: 4.0.3
@@ -20501,7 +20492,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.15.1
is-glob: 4.0.3
@@ -21436,7 +21427,7 @@ snapshots:
dependencies:
'@tootallnate/once': 2.0.0
agent-base: 6.0.2
- debug: 4.4.0
+ debug: 4.4.1
transitivePeerDependencies:
- supports-color
@@ -21450,14 +21441,14 @@ snapshots:
dependencies:
agent-base: 7.1.3
- debug: 4.4.0
+ debug: 4.4.1
transitivePeerDependencies:
- supports-color
dependencies:
agent-base: 6.0.2
- debug: 4.4.0
+ debug: 4.4.1
transitivePeerDependencies:
- supports-color
@@ -21471,7 +21462,7 @@ snapshots:
dependencies:
agent-base: 7.1.3
- debug: 4.3.7([email protected])
+ debug: 4.3.7
transitivePeerDependencies:
- supports-color
@@ -22228,7 +22219,7 @@ snapshots:
dependencies:
- '@types/node': 20.10.5
+ '@types/node': 20.14.8
merge-stream: 2.0.0
supports-color: 8.1.1
@@ -23217,7 +23208,7 @@ snapshots:
dependencies:
type-fest: 2.19.0
dependencies:
'@babel/runtime': 7.26.0
'@panva/hkdf': 1.1.1
@@ -24494,7 +24485,7 @@ snapshots:
dependencies:
- debug: 4.3.7([email protected])
+ debug: 4.4.1
module-details-from-path: 1.0.3
resolve: 1.22.8
transitivePeerDependencies:
@@ -25715,7 +25706,7 @@ snapshots:
dependencies:
cac: 6.7.14
- debug: 4.3.7([email protected])
+ debug: 4.4.1
pathe: 1.1.2
vite: 5.2.14(@types/[email protected])
transitivePeerDependencies:
@@ -25732,7 +25723,7 @@ snapshots:
dependencies:
cac: 6.7.14
- debug: 4.3.7([email protected])
+ debug: 4.4.1
pathe: 1.1.2
vite: 5.2.14(@types/[email protected])([email protected])
transitivePeerDependencies:
@@ -25748,7 +25739,7 @@ snapshots:
dependencies:
cac: 6.7.14
- debug: 4.3.7([email protected])
+ debug: 4.4.1
pathe: 1.1.2
vite: 5.2.14(@types/[email protected])
transitivePeerDependencies: