690513:0920 Refactor Workflow module: Lint error #01
This commit is contained in:
@@ -24,7 +24,9 @@ Every response must be **precise**, **spec-compliant**, and **production-ready**
|
||||
## Project Information
|
||||
|
||||
- **Project:** NAP-DMS (LCBP3)
|
||||
- **Version:** 1.8.6
|
||||
- Version: 1.9.0
|
||||
- Last Updated: 2026-05-13
|
||||
- Canonical Source: AGENTS.md
|
||||
- **Stack:** NestJS + Next.js + TypeScript + MariaDB + Ollama (AI)
|
||||
- **Repo:** https://git.np-dms.work/np-dms/lcbp3
|
||||
|
||||
@@ -58,3 +60,24 @@ Best practice — follow when possible:
|
||||
- Code style / formatting (Prettier handles)
|
||||
- Comment completeness
|
||||
- Minor optimizations
|
||||
|
||||
---
|
||||
|
||||
## 📐 TypeScript Rules & Coding Standards (v1.9.0)
|
||||
|
||||
### 📝 Core Standards
|
||||
|
||||
- **Strict Mode** — all strict checks enforced.
|
||||
- **ZERO `any` types** — use proper types or `unknown` + narrowing.
|
||||
- **ZERO `console.log`** — use NestJS `Logger` (backend) or remove before commit (frontend).
|
||||
- **English for Code** — use English for all code identifiers, variables, and logic.
|
||||
- **Thai for Comments** — use Thai for comments, documentation, and JSDoc.
|
||||
- **Explicit Typing** — explicitly define types for all variables, parameters, and return values.
|
||||
- **JSDoc** — use JSDoc for all public classes and methods.
|
||||
|
||||
### 🏗️ File & Function Structure
|
||||
|
||||
- **File Headers** — every file MUST start with `// File: path/filename` on the first line.
|
||||
- **Change Log** — include `// Change Log` at the top of the file to track modifications.
|
||||
- **Single Export** — export **only one main symbol** per file.
|
||||
- **Function Style** — avoid unnecessary blank lines inside functions.
|
||||
|
||||
@@ -1,32 +1,36 @@
|
||||
---
|
||||
trigger: always_on
|
||||
---
|
||||
# TypeScript Rules (v1.9.0)
|
||||
|
||||
# TypeScript Rules
|
||||
## Core Standards
|
||||
|
||||
## Strict Requirements
|
||||
- **Strict Mode** — all strict checks enforced.
|
||||
- **ZERO `any` types** — use proper types or `unknown` + narrowing.
|
||||
- **ZERO `console.log`** — use NestJS `Logger` (backend) or remove before commit (frontend).
|
||||
- **English for Code** — use English for all code identifiers, variables, and logic.
|
||||
- **Thai for Comments** — use Thai for comments, documentation, and JSDoc.
|
||||
- **Explicit Typing** — explicitly define types for all variables, parameters, and return values.
|
||||
- **JSDoc** — use JSDoc for all public classes and methods (in **Thai**).
|
||||
|
||||
- **Strict Mode** — all strict checks enforced
|
||||
- **ZERO `any` types** — use proper types or `unknown` + narrowing
|
||||
- **ZERO `console.log`** — NestJS `Logger` (backend); remove before commit (frontend)
|
||||
## File & Function Structure
|
||||
|
||||
## Comment Language Policy
|
||||
- **File Headers** — every file MUST start with `// File: path/filename` on the first line.
|
||||
- **Change Log** — include `// Change Log` at the top of the file.
|
||||
- **Single Export** — export **only one main symbol** per file.
|
||||
- **Function Style** — avoid unnecessary blank lines inside functions.
|
||||
|
||||
- **Comments:** Thai (เข้าใจง่ายสำหรับทีมไทย)
|
||||
- **Code Identifiers:** English (variables, functions, classes)
|
||||
|
||||
## Error Handling Pattern
|
||||
## Patterns
|
||||
|
||||
```typescript
|
||||
// Backend (NestJS)
|
||||
import { Logger } from '@nestjs/common';
|
||||
const logger = new Logger('ServiceName');
|
||||
// ✅ CORRECT
|
||||
// File: src/example.service.ts
|
||||
// Change Log:
|
||||
// - 2026-05-13: Initial creation
|
||||
|
||||
// Use logger instead of console.log
|
||||
logger.error('Error message', error.stack);
|
||||
throw new HttpException('Message', HttpStatus.BAD_REQUEST);
|
||||
|
||||
// Frontend (Next.js)
|
||||
// Remove all console.log before commit
|
||||
// Use proper error boundaries and toast notifications
|
||||
/**
|
||||
* บริการตัวอย่างสำหรับ LCBP3
|
||||
*/
|
||||
export class ExampleService {
|
||||
public doSomething(data: string): boolean {
|
||||
return data.length > 0;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -18,9 +18,13 @@ trigger: always_on
|
||||
|
||||
## 🟡 Normal Work — UI / Feature / Integration
|
||||
|
||||
- Follow existing patterns in codebase
|
||||
- Check spec for relevant module only
|
||||
- No need to read all specs
|
||||
- Follow existing patterns in codebase.
|
||||
- Check spec for relevant module only.
|
||||
- **Hybrid Specs Organization:**
|
||||
- Place new Infrastructure tasks in `specs/100-Infrastructures/`
|
||||
- Place new Feature/Workflow tasks in `specs/200-fullstacks/`
|
||||
- Place Documentation/Research in `specs/300-others/`
|
||||
- Ensure no forbidden patterns (`any`, `console.log`, UUID misuse) are introduced.
|
||||
|
||||
## 🟢 Quick Fix — Bug Fix / Typo / Style
|
||||
|
||||
|
||||
Reference in New Issue
Block a user