Skip to content

hopefully last linter setup push #3

hopefully last linter setup push

hopefully last linter setup push #3

Workflow file for this run

name: TypeScript Lint & Format
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
lint:
name: Lint & Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: |
frontend/package-lock.json
backend/package-lock.json
# Frontend linting
- name: Install frontend dependencies
working-directory: ./frontend
run: npm ci
- name: Lint frontend TypeScript
working-directory: ./frontend
run: npm run lint
- name: Check frontend TypeScript types
working-directory: ./frontend
run: npm run type-check
- name: Format check frontend
working-directory: ./frontend
run: npm run format:check
# Backend linting
- name: Install backend dependencies
working-directory: ./backend
run: npm ci
- name: Lint backend TypeScript
working-directory: ./backend
run: npm run lint
- name: Check backend TypeScript types
working-directory: ./backend
run: npm run type-check
- name: Format check backend
working-directory: ./backend
run: npm run format:check
auto-fix:
name: Auto-fix & Format
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: |
frontend/package-lock.json
backend/package-lock.json
# Auto-fix frontend
- name: Install frontend dependencies
working-directory: ./frontend
run: npm ci
- name: Auto-fix frontend linting issues
working-directory: ./frontend
run: npm run lint:fix
- name: Format frontend code
working-directory: ./frontend
run: npm run format
# Auto-fix backend
- name: Install backend dependencies
working-directory: ./backend
run: npm ci
- name: Auto-fix backend linting issues
working-directory: ./backend
run: npm run lint:fix
- name: Format backend code
working-directory: ./backend
run: npm run format
# Commit fixes if any
- name: Commit auto-fixes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git diff --staged --quiet || git commit -m "🤖 Auto-fix linting and formatting issues"
git push