Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/fix: full repo Biome linting and formatting, added tests for PR checking #139

Merged
merged 12 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
125 changes: 125 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
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

- name: Run Biome lint
working-directory: frontend
run: pnpm exec biome lint ./src

- name: Run Biome format check
working-directory: frontend
run: pnpm exec biome format --check ./src

- name: Type check
working-directory: frontend
run: pnpm type-check

- name: Run tests
working-directory: frontend
run: pnpm test

- name: Build application
working-directory: frontend
run: pnpm build

security:
name: Security Scan
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

- name: Run security audit
working-directory: frontend
run: pnpm audit

- name: Check for outdated dependencies
working-directory: frontend
run: pnpm outdated

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

- name: Build and analyze bundle
working-directory: frontend
run: pnpm build
env:
ANALYZE: true
BUNDLE_ANALYZE_MODE: 'static'
BUNDLE_ANALYZE_REPORT: 'bundle-analysis.html'
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
68 changes: 68 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": true,
"include": [
"src/app/**/page.tsx",
"src/app/layout.tsx",
"src/components/**/*.tsx",
"src/hooks/**/*.ts",
"src/providers/**/*.tsx",
"src/middleware.ts"
],
"ignore": [
"**/node_modules/**",
"**/.next/**",
"**/dist/**",
"**/build/**",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx",
"src/app/api-docs/**",
"src/components/ui/icons/**"
]
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify coverage of critical paths.

The file patterns look good but verify that all critical paths are covered:

  • API routes under src/app/api
  • Utility functions under src/utils
  • Type definitions under src/types

🏁 Script executed:

#!/bin/bash
# Check for potentially missing paths
echo "Checking for .ts/.tsx files outside included paths..."
fd -e ts -e tsx . src/ \
  --exclude 'node_modules' \
  --exclude '.next' \
  --exclude 'dist' \
  --exclude 'build' \
  --exclude '*.test.*' \
  --exclude '*.spec.*' \
  --exclude 'api-docs' \
  --exclude 'icons' \
  | grep -vE "^(src/app/.*page\.tsx|src/app/layout\.tsx|src/components/.*\.tsx|src/hooks/.*\.ts|src/providers/.*\.tsx|src/middleware\.ts)$"

Length of output: 518


🏁 Script executed:

#!/bin/bash
# First, check if a "src" directory exists at the repository root.
echo "Checking if 'src' directory exists:"
if [ -d "./src" ]; then
  echo "'src' directory exists."
else
  echo "'src' directory does not exist. Listing directories at the root:"
  ls -d */
fi

echo ""
echo "Listing any directories that include 'src' in their name:"
find . -type d -name "*src*"

echo ""
echo "Searching for TypeScript files in critical paths:"
for path in "src/app/api" "src/utils" "src/types"; do
  echo "Files under $path:"
  fd -e ts -e tsx "^$path/" || echo "No files found in $path"
done

Length of output: 1023

Critical File Pattern Configuration Issue

The JSON globs reference a top-level src directory, yet the codebase places application files under frontend/src and type definitions in a separate types folder. This means:

  • API routes (likely under frontend/src/app/api) aren’t covered.
  • Utility functions (likely under frontend/src/utils) aren’t included.
  • Type definitions in the types directory are also omitted.

Please update the biome.json patterns to reflect the actual repository structure.

"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error",
"noUndeclaredVariables": "error"
},
"performance": {
"noDelete": "error"
},
"style": {
"noNonNullAssertion": "warn",
"useConst": "warn"
},
"suspicious": {
"noExplicitAny": "warn",
"noConsoleLog": "warn"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"trailingCommas": "all",
"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
8 changes: 7 additions & 1 deletion frontend/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import bundleAnalyzer from '@next/bundle-analyzer'

const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
})

/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
Expand All @@ -21,4 +27,4 @@ const nextConfig = {
},
};

export default nextConfig;
export default withBundleAnalyzer(nextConfig);
Loading
Loading