Skip to content

Commit de84370

Browse files
ci: add frontend lint check
1 parent e4d9d28 commit de84370

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Frontend Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'frontend/**'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'frontend/**'
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
frontend-lint:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '18'
29+
cache: 'yarn'
30+
cache-dependency-path: 'frontend/yarn.lock'
31+
32+
- name: Install dependencies
33+
working-directory: frontend
34+
run: yarn install --frozen-lockfile
35+
36+
- name: Run ESLint (must have 0 errors)
37+
working-directory: frontend
38+
run: |
39+
echo "🧹 Running ESLint - checking for 0 errors..."
40+
41+
# Run lint and capture output
42+
LINT_OUTPUT=$(yarn lint 2>&1)
43+
LINT_EXIT_CODE=$?
44+
45+
echo "$LINT_OUTPUT"
46+
47+
# Parse the output to check for errors
48+
if echo "$LINT_OUTPUT" | grep -q "✖.*errors\?"; then
49+
ERROR_COUNT=$(echo "$LINT_OUTPUT" | grep -o '[0-9]\+ error' | head -1 | grep -o '[0-9]\+' || echo "unknown")
50+
echo ""
51+
echo "❌ ESLint found $ERROR_COUNT errors. All errors must be fixed before merging."
52+
echo "💡 Run 'cd frontend && yarn lint:fix' to automatically fix some issues."
53+
echo "💡 Or fix them manually and commit the changes."
54+
exit 1
55+
elif [ $LINT_EXIT_CODE -ne 0 ]; then
56+
echo "❌ ESLint failed with exit code $LINT_EXIT_CODE"
57+
exit 1
58+
else
59+
echo "✅ ESLint passed with 0 errors!"
60+
fi
61+
62+
- name: Run TypeScript check
63+
working-directory: frontend
64+
run: |
65+
echo "🔍 Running TypeScript check..."
66+
yarn typecheck
67+
68+
if [ $? -eq 0 ]; then
69+
echo "✅ TypeScript check passed!"
70+
else
71+
echo "❌ TypeScript check failed"
72+
exit 1
73+
fi

0 commit comments

Comments
 (0)