Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# File: .github/workflows/lint.yml

name: Code Quality Checks (Linting)

# 1. Ensure both workflows run on: pull request and push to main branches
on:
push:
branches:
- main
pull_request:
branches:
- main
# Optional: Allows manual trigger from the GitHub Actions tab
workflow_dispatch:

jobs:
# =======================================================
# JOB 1: ESLint (JavaScript/Frontend)
# =======================================================
eslint-check:
name: 🎨 ESLint (Frontend)
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
# Use a modern LTS version
node-version: '20'
# Use cache for faster dependency installation
cache: 'npm'
# Tell the action where the lock file is located
cache-dependency-path: frontend/package-lock.json

- name: Install Frontend Dependencies
# Run inside the frontend directory
run: npm install
working-directory: frontend

- name: Run ESLint
# This executes the "lint" script defined in frontend/package.json
run: npm run lint
working-directory: frontend

# =======================================================
# JOB 2: Flake8 (Python/Backend)
# =======================================================
flake8-check:
name: 🐍 Flake8 (Backend)
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
# Choose a compatible Python version
python-version: '3.10'

- name: Install Flake8 and Backend Dependencies
# Assuming you use a requirements.txt in the backend/ directory or root
run: |
pip install flake8
if [ -f backend/requirements.txt ]; then
pip install -r backend/requirements.txt
fi
# Or if requirements is at the root: pip install -r requirements.txt

- name: Run Flake8 on Backend Code
# Run Flake8 against the 'backend' directory.
# It will use the configuration from the .flake8 file if present.
run: flake8 backend/

4 changes: 4 additions & 0 deletions backend/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 120
exclude = .git,__pycache__,venv,env,ENV,.venv,sessions,data

1 change: 1 addition & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ flask-cors==4.0.0
flask-session==0.5.0
Werkzeug==3.0.1
python-dotenv==1.0.0
flake8==7.3.0

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
"three": "^0.181.2"
},
"devDependencies": {
"@babel/eslint-parser": "^7.28.5",
"@eslint/js": "^9.39.1",
"@types/react": "^19.2.5",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.1",
"autoprefixer": "^10.4.22",
"eslint": "^9.39.1",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.24",
"globals": "^16.5.0",
Expand Down
Loading