Skip to content

Commit

Permalink
Merge pull request #139 from evgongora/feat/integrate-biome
Browse files Browse the repository at this point in the history
feat/fix: full repo Biome linting and formatting, added tests for PR checking
  • Loading branch information
evgongora authored Feb 6, 2025
2 parents 5697889 + 5a44ab9 commit 2ef70b9
Show file tree
Hide file tree
Showing 96 changed files with 5,419 additions and 4,042 deletions.
154 changes: 154 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: PR Check

on:
pull_request:
branches: [ main, develop ]

jobs:
quality:
name: Code Quality & Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
cd frontend
pnpm install
pnpm add -D @biomejs/biome @next/bundle-analyzer
cp ../biome.json .
- name: Run Biome lint
working-directory: frontend
run: |
echo "Node version: $(node -v)"
echo "Current directory: $(pwd)"
echo "Running Biome lint..."
pnpm exec biome ci .
- name: Run Biome format check
working-directory: frontend
run: |
echo "Running Biome format check..."
pnpm exec biome check --files-ignore-unknown=true .
- name: Type check
working-directory: frontend
run: pnpm exec tsc --noEmit

- name: Run tests
working-directory: frontend
run: pnpm test || echo "No tests found"

- name: Build application
working-directory: frontend
env:
NEXT_TELEMETRY_DISABLED: 1
JWT_SECRET: ${{ secrets.JWT_SECRET || 'dummy-secret-for-ci' }}
NEXT_PUBLIC_WLD_APP_ID: ${{ secrets.NEXT_PUBLIC_WLD_APP_ID || 'app_staging_0' }}
run: pnpm build

security:
name: Security Scan
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install dependencies
run: |
cd frontend
pnpm install
- name: Run security audit
working-directory: frontend
run: |
pnpm audit || echo "Security vulnerabilities found. Please review the report above."
- name: Check for outdated dependencies
working-directory: frontend
run: |
pnpm outdated || echo "Outdated dependencies found. Please review the report above."
bundle-analysis:
name: Bundle Analysis
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install dependencies
run: |
cd frontend
pnpm install
pnpm add -D @next/bundle-analyzer
- name: Build and analyze bundle
working-directory: frontend
env:
ANALYZE: true
NEXT_TELEMETRY_DISABLED: 1
JWT_SECRET: ${{ secrets.JWT_SECRET || 'dummy-secret-for-ci' }}
NEXT_PUBLIC_WLD_APP_ID: ${{ secrets.NEXT_PUBLIC_WLD_APP_ID || 'app_staging_0' }}
run: |
pnpm build
- name: Upload bundle analysis
if: success()
uses: actions/upload-artifact@v4
with:
name: bundle-analysis
path: |
frontend/.next/analyze/client.html
frontend/.next/analyze/edge.html
frontend/.next/analyze/nodejs.html
compression-level: 9
retention-days: 14
20 changes: 0 additions & 20 deletions .github/workflows/relyance-sci.yml

This file was deleted.

40 changes: 39 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
.DS_Store
# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
!.env.example
.env
.env.*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# IDE
.vscode
.idea
74 changes: 74 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": true,
"include": [
"src/**/*.{ts,tsx}",
"src/**/*.{js,jsx}",
"src/**/*.json",
"*.config.{ts,js,mjs}",
"*.d.ts",
"eslint.config.mjs",
"next.config.mjs",
"tailwind.config.ts",
"postcss.config.js"
],
"ignore": [
"**/node_modules/**",
"**/.next/**",
"**/dist/**",
"**/build/**",
"**/*.test.{ts,tsx}",
"**/*.spec.{ts,tsx}",
"**/coverage/**",
"**/storybook-static/**",
"src/app/api-docs/**",
"src/components/ui/icons/**",
".xata/**",
"**/generated/**"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"formatWithErrors": false
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"useImportType": "error",
"useNodejsImportProtocol": "error"
},
"correctness": {
"noUnusedVariables": "error",
"noUndeclaredVariables": "error"
},
"suspicious": {
"noExplicitAny": "error",
"noConsoleLog": "error"
}
}
},
"javascript": {
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"quoteStyle": "double",
"semicolons": "always"
}
}
}
23 changes: 23 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Next Auth Configuration
NEXTAUTH_URL=
NEXTAUTH_SECRET=
JWT_SECRET=

# Worldcoin Integration
WLD_CLIENT_ID=
WLD_CLIENT_SECRET=
NEXT_PUBLIC_WLD_APP_ID=
APP_ID=

# API Keys
DEV_PORTAL_API_KEY=

# Xata Database
XATA_BRANCH=
XATA_API_KEY=
XATA_DATABASE_URL=

# Environment Configuration
NEXT_PUBLIC_PAYMENT_ADDRESS=
NEXT_PUBLIC_APP_ENV=
NODE_ENV=
6 changes: 4 additions & 2 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*
# env files
.env
.env.*
!.env.example

# vercel
.vercel
Expand Down
Loading

0 comments on commit 2ef70b9

Please sign in to comment.