fix: add TypeScript declarations for SCSS modules and images, consolidate CI workflows
- Add type declarations for .module.scss files - Add type declarations for image imports (png, jpg, svg, etc.) - Update tsconfig.json to include new type declaration files - Consolidate duplicate lint/typecheck workflows into single Code Quality Check - Remove redundant pr-lint-check.yml and push-lint-check.yml - Unified workflow runs both ESLint and TypeScript checks
This commit is contained in:
58
.github/workflows/pr-lint-check.yml
vendored
58
.github/workflows/pr-lint-check.yml
vendored
@@ -1,58 +0,0 @@
|
|||||||
name: PR Lint Check
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Run ESLint
|
|
||||||
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'
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
|
||||||
uses: pnpm/action-setup@v4
|
|
||||||
with:
|
|
||||||
version: 10
|
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Setup pnpm cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ${{ env.STORE_PATH }}
|
|
||||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-pnpm-store-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Run ESLint
|
|
||||||
run: pnpm run lint
|
|
||||||
|
|
||||||
- name: Comment PR on failure
|
|
||||||
if: failure()
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
github.rest.issues.createComment({
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
body: '❌ ESLint check failed. Please fix the linting errors before merging.'
|
|
||||||
})
|
|
||||||
52
.github/workflows/push-lint-check.yml
vendored
52
.github/workflows/push-lint-check.yml
vendored
@@ -1,52 +0,0 @@
|
|||||||
name: Push Lint Check
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- '**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Run ESLint on Push
|
|
||||||
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'
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
|
||||||
uses: pnpm/action-setup@v4
|
|
||||||
with:
|
|
||||||
version: 10
|
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Setup pnpm cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ${{ env.STORE_PATH }}
|
|
||||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-pnpm-store-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Run ESLint
|
|
||||||
run: pnpm run lint
|
|
||||||
|
|
||||||
- name: Notify on failure
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
echo "::error::ESLint check failed. Please run 'pnpm run lintfix' locally to fix issues."
|
|
||||||
23
.github/workflows/typecheck.yml
vendored
23
.github/workflows/typecheck.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: TypeScript Type Check
|
name: Code Quality Check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -14,8 +14,8 @@ on:
|
|||||||
- develop
|
- develop
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
typecheck:
|
quality-check:
|
||||||
name: TypeScript Type Check
|
name: Lint & Type Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -48,10 +48,25 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Run ESLint
|
||||||
|
run: pnpm run lint
|
||||||
|
|
||||||
- name: Run TypeScript type check
|
- name: Run TypeScript type check
|
||||||
run: pnpm run typecheck
|
run: pnpm run typecheck
|
||||||
|
|
||||||
|
- name: Comment PR on failure
|
||||||
|
if: failure() && github.event_name == 'pull_request'
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
github.rest.issues.createComment({
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
body: '❌ Code quality check failed. Please run `./windsurf-commands.sh lintfix` and `./windsurf-commands.sh typecheck` locally to fix issues.'
|
||||||
|
})
|
||||||
|
|
||||||
- name: Notify on failure
|
- name: Notify on failure
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
echo "::error::TypeScript type check failed. Please fix type errors before merging."
|
echo "::error::Code quality check failed. Please fix linting and type errors before merging."
|
||||||
|
|||||||
19
AGENTS.md
19
AGENTS.md
@@ -55,17 +55,6 @@
|
|||||||
|
|
||||||
## Development Workflow
|
## Development Workflow
|
||||||
|
|
||||||
### Commands
|
|
||||||
- `pnpm dev` - Start dev server (port 4000)
|
|
||||||
- `pnpm build` - Production build
|
|
||||||
- `pnpm start` - Start production server
|
|
||||||
- `pnpm lint` - Check for linting issues
|
|
||||||
- `pnpm lintfix` - Auto-fix linting issues
|
|
||||||
- `pnpm typecheck` - Run TypeScript type checking
|
|
||||||
- `pnpm security:audit` - Run security vulnerability scan
|
|
||||||
- `pnpm security:check` - Generate security report (JSON)
|
|
||||||
- `pnpm security:outdated` - Check for outdated dependencies
|
|
||||||
|
|
||||||
### Windsurf Commands Helper Script
|
### Windsurf Commands Helper Script
|
||||||
The project includes `windsurf-commands.sh` for common development tasks:
|
The project includes `windsurf-commands.sh` for common development tasks:
|
||||||
|
|
||||||
@@ -83,13 +72,7 @@ The project includes `windsurf-commands.sh` for common development tasks:
|
|||||||
- Script provides consistent interface for development commands
|
- Script provides consistent interface for development commands
|
||||||
- All commands use `pnpm` internally
|
- All commands use `pnpm` internally
|
||||||
- Includes error handling and user-friendly output with emojis
|
- Includes error handling and user-friendly output with emojis
|
||||||
- Can be used interchangeably with direct `pnpm run` commands
|
- Avoid using `pnpm run` commands directly
|
||||||
|
|
||||||
### Before Committing
|
|
||||||
1. Run `pnpm run lintfix` and `pnpm run lint` (or use `./windsurf-commands.sh lintfix` and `./windsurf-commands.sh lint`)
|
|
||||||
2. Run `pnpm run typecheck` (or `./windsurf-commands.sh typecheck`) to ensure TypeScript compiles
|
|
||||||
3. Run `pnpm run security:audit` (or `./windsurf-commands.sh security:audit`) to check for vulnerabilities
|
|
||||||
4. Test changes in browser
|
|
||||||
|
|
||||||
## File Naming
|
## File Naming
|
||||||
- **Components**: PascalCase (`MainPage.tsx`)
|
- **Components**: PascalCase (`MainPage.tsx`)
|
||||||
|
|||||||
29
src/types/images.d.ts
vendored
Normal file
29
src/types/images.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
declare module "*.png" {
|
||||||
|
const value: string;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.jpg" {
|
||||||
|
const value: string;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.jpeg" {
|
||||||
|
const value: string;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.svg" {
|
||||||
|
const value: string;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.gif" {
|
||||||
|
const value: string;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.webp" {
|
||||||
|
const value: string;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
4
src/types/scss.d.ts
vendored
Normal file
4
src/types/scss.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
declare module "*.module.scss" {
|
||||||
|
const classes: { [key: string]: string };
|
||||||
|
export default classes;
|
||||||
|
}
|
||||||
@@ -23,6 +23,6 @@
|
|||||||
"@/*": ["./*"]
|
"@/*": ["./*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/types/**/*.d.ts"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user