42 lines
869 B
YAML
42 lines
869 B
YAML
name: Code Linting
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- develop
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint JavaScript Code
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Check for syntax errors
|
|
run: node -c server.js
|
|
|
|
- name: Run ESLint (if configured)
|
|
run: |
|
|
if [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] || [ -f "eslint.config.js" ]; then
|
|
npx eslint . --ext .js
|
|
else
|
|
echo "ESLint not configured, skipping..."
|
|
fi
|
|
continue-on-error: true
|