build-report

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Build Report Generator

构建报告生成器

Generate structured, actionable reports from build outputs for Node.js projects.
为Node.js项目从构建输出中生成结构化、可执行的报告。

Overview

概述

Build Report transforms raw build outputs into organized, prioritized reports. Instead of duplicating official documentation, this skill focuses on:
  • Parsing and extracting errors from multiple tools (TypeScript, ESLint, Webpack, Vite)
  • Grouping similar errors by pattern and root cause
  • Prioritizing issues by impact and severity
  • Analyzing dependencies between errors (what to fix first)
  • Linking to official docs for detailed solutions
  • Executive summary for quick decision making
This skill complements (not replaces) official documentation by providing triage, context, and actionable next steps.
构建报告可将原始构建输出转换为有条理、分优先级的报告。该技能不会重复官方文档内容,而是专注于以下方面:
  • 解析与提取:从多种工具(TypeScript、ESLint、Webpack、Vite)中提取错误信息
  • 分组归类:按模式和根本原因对相似错误进行分组
  • 优先级排序:根据影响程度和严重性对问题排序
  • 依赖分析:分析错误之间的依赖关系(确定修复顺序)
  • 官方文档链接:提供指向详细解决方案的官方文档链接
  • 执行摘要:便于快速决策
该技能通过提供问题分类、上下文信息和可执行的后续步骤,对官方文档进行补充(而非替代)。

Prerequisites

前置条件

  • Node.js project with npm/yarn/pnpm
  • Build tools: TypeScript, ESLint, Webpack, Vite, or similar
  • Build output (from console or CI/CD logs)
  • Optional: Git for historical comparisons
  • 基于npm/yarn/pnpm的Node.js项目
  • 构建工具:TypeScript、ESLint、Webpack、Vite或同类工具
  • 构建输出(来自控制台或CI/CD日志)
  • 可选:用于历史对比的Git

Instructions

操作步骤

1. Capture the Build Output

1. 捕获构建输出

Collect the complete build output including:
bash
undefined
收集完整的构建输出,包括:
bash
undefined

Full build command output

完整构建命令输出

npm run build
npm run build

Or from CI/CD logs

或来自CI/CD日志

Copy the entire build section

复制整个构建部分的内容


**What to include:**

- Full command that was run
- All stdout and stderr output
- Exit code (if available)
- Timestamp and duration (if available)

**需要包含的内容:**

- 执行的完整命令
- 所有标准输出(stdout)和标准错误(stderr)内容
- 退出码(如果有)
- 时间戳和构建时长(如果有)

2. Identify Build Tools and Errors

2. 识别构建工具与错误

Scan the output to detect which build tools are present:
TypeScript errors:
src/file.ts:23:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
ESLint warnings:
src/file.ts:12:7 warning 'variable' is defined but never used @typescript-eslint/no-unused-vars
Webpack errors:
ERROR in ./src/components/Button.tsx
Module not found: Error: Can't resolve '@/styles/button.css'
Vite errors:
✘ [ERROR] Could not resolve "react-dom/client"
扫描输出内容,检测所使用的构建工具:
TypeScript错误:
src/file.ts:23:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
ESLint警告:
src/file.ts:12:7 warning 'variable' is defined but never used @typescript-eslint/no-unused-vars
Webpack错误:
ERROR in ./src/components/Button.tsx
Module not found: Error: Can't resolve '@/styles/button.css'
Vite错误:
✘ [ERROR] Could not resolve "react-dom/client"

3. Parse and Extract Structured Data

3. 解析并提取结构化数据

For each error/warning, extract:
  • File path: Full or relative path to the file
  • Line number: Where the issue occurs
  • Column number: (if available)
  • Error code: TS2345, E501, etc.
  • Message: The error description
  • Severity: error or warning
  • Tool: TypeScript, ESLint, Webpack, etc.
Example parsing:
Input: "src/auth/login.ts:23:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'."

Extracted:
{
  file: "src/auth/login.ts",
  line: 23,
  column: 15,
  code: "TS2345",
  message: "Argument of type 'string' is not assignable to parameter of type 'number'",
  severity: "error",
  tool: "TypeScript"
}
针对每个错误/警告,提取以下信息:
  • 文件路径:文件的完整路径或相对路径
  • 行号:问题出现的行号
  • 列号(如果有)
  • 错误代码:TS2345、E501等
  • 错误信息:错误描述内容
  • 严重程度:error(错误)或warning(警告)
  • 工具类型:TypeScript、ESLint、Webpack等
解析示例:
输入:"src/auth/login.ts:23:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'."

提取结果:
{
  file: "src/auth/login.ts",
  line: 23,
  column: 15,
  code: "TS2345",
  message: "Argument of type 'string' is not assignable to parameter of type 'number'",
  severity: "error",
  tool: "TypeScript"
}

4. Group Errors by Pattern

4. 按模式分组错误

Group similar errors together:
Grouping strategies:
  1. By error code: All TS2345 errors together
  2. By message pattern: Similar error messages
  3. By file/module: All errors in
    auth/
    module
  4. By root cause: Same underlying issue
Example groups:
Group 1: Type mismatch string→number (TS2345)
├─ src/auth/login.ts:23
├─ src/auth/register.ts:45
└─ src/auth/validate.ts:12
(4 occurrences)

Group 2: Cannot find name 'User' (TS2304)
└─ src/utils/validate.ts:12
(1 occurrence)
将相似错误分组:
分组策略:
  1. 按错误代码:所有TS2345错误归为一组
  2. 按信息模式:相似的错误信息归为一组
  3. 按文件/模块:所有
    auth/
    模块中的错误归为一组
  4. 按根本原因:由同一底层问题导致的错误归为一组
分组示例:
组1:类型不匹配 string→number(TS2345)
├─ src/auth/login.ts:23
├─ src/auth/register.ts:45
└─ src/auth/validate.ts:12
(共4次出现)

组2:找不到名称'User'(TS2304)
└─ src/utils/validate.ts:12
(共1次出现)

5. Prioritize Issues

5. 对问题进行优先级排序

Assign priority based on:
PriorityCriteriaSymbol
🔴 CRITICALBuild blocker (errors that prevent compilation)MUST FIX
🟡 HIGHReduces code quality significantlySHOULD FIX
🟢 MEDIUMCode quality issues, non-blockingNICE TO FIX
LOWStyle/formatting, deprecation warningsOPTIONAL
Priority rules:
  • All TypeScript errors → 🔴 CRITICAL
  • ESLint errors → 🟡 HIGH
  • ESLint warnings (complexity, unused vars) → 🟡 HIGH to 🟢 MEDIUM
  • Deprecation warnings → ⚪ LOW
  • Bundle size warnings → 🟢 MEDIUM
根据以下标准分配优先级:
优先级判断标准标识
🔴 CRITICAL(严重)构建阻塞(阻止编译的错误)必须修复
🟡 HIGH(高)显著降低代码质量应该修复
🟢 MEDIUM(中)代码质量问题,不阻塞构建建议修复
LOW(低)样式/格式、弃用警告可选修复
优先级规则:
  • 所有TypeScript错误 → 🔴 严重
  • ESLint错误 → 🟡 高
  • ESLint警告(复杂度、未使用变量) → 🟡 高至🟢 中
  • 弃用警告 → ⚪ 低
  • 包体积警告 → 🟢 中

6. Find Solutions and Documentation

6. 查找解决方案与文档

For each error group, provide:
Solution steps:
  1. Specific actions to resolve the issue
  2. Code examples (before/after)
  3. Alternative approaches if applicable
Documentation links:
  • Official documentation for the error code
  • Related Stack Overflow questions
  • Framework-specific guides
Common solutions database:
  • See references/solutions-database.md for error code mappings
Example solution:
markdown
**Solution for TS2345 (Type Mismatch):**

1. Option A: Convert the value to expected type
   ```typescript
   calculate(Number(userId)); // string → number
   ```
  1. Option B: Update the parameter type
    typescript
    function calculate(id: string | number) { ... }
  2. Option C: Fix the source type
    typescript
    const userId: number = getNumericUserId();
Documentation:
undefined
针对每个错误组,提供以下内容:
解决方案步骤:
  1. 解决问题的具体操作
  2. 代码示例(修复前后对比)
  3. 可选的替代方案
文档链接:
  • 错误代码对应的官方文档
  • 相关的Stack Overflow问题
  • 框架特定指南
常见解决方案数据库:
  • 查看references/solutions-database.md获取错误代码映射
解决方案示例:
markdown
**TS2345(类型不匹配)解决方案:**

1. 选项A:将值转换为预期类型
   ```typescript
   calculate(Number(userId)); // string → number
   ```
  1. 选项B:更新参数类型
    typescript
    function calculate(id: string | number) { ... }
  2. 选项C:修复源头类型
    typescript
    const userId: number = getNumericUserId();
文档链接:
undefined

7. Generate Executive Summary

7. 生成执行摘要

Create a concise overview:
markdown
undefined
创建简洁的概述:
markdown
undefined

📊 Executive Summary

📊 执行摘要

Build FAILED after 12.4s with 23 errors and 124 warnings.
Impact: 🔴 CRITICAL - Project does not compile Priority: Resolve TypeScript errors in auth module (8 errors)
构建失败,耗时12.4秒,共23个错误和124个警告。
影响: 🔴 严重 - 项目无法编译 优先级: 优先修复auth模块中的TypeScript错误(共8个)

Top Issues:

主要问题:

  1. 🔴 TypeScript: 8 type errors (auth module) - BLOCKER
  2. 🟡 ESLint: 52 unused variables (15 files) - HIGH
  3. 🟢 Webpack: 3 bundle size warnings - MEDIUM

**Include:**

- Overall status (SUCCESS, SUCCESS WITH WARNINGS, FAILED)
- Total errors and warnings count
- Impact level
- Top 3 issues to address
- Quick recommendation
  1. 🔴 TypeScript:8个类型错误(auth模块) - 阻塞构建
  2. 🟡 ESLint:52个未使用变量(15个文件) - 高优先级
  3. 🟢 Webpack:3个包体积警告 - 中优先级

**需要包含的内容:**

- 整体状态(SUCCESS成功、SUCCESS WITH WARNINGS带警告成功、FAILED失败)
- 错误和警告总数
- 影响级别
- 前3个需处理的问题
- 快速建议

8. Format the Complete Report

8. 格式化完整报告

Use the following structure:
markdown
undefined
使用以下结构:
markdown
undefined

Build Report - [project-name]

构建报告 - [项目名称]

✅ Result: [STATUS]

✅ 结果:[状态]

Status: ✅ SUCCESS | ⚠️ SUCCESS WITH WARNINGS | 🔴 FAILED Duration: [X]s Timestamp: [date time] Branch: [if available] Commit: [if available]
状态: ✅ 成功 | ⚠️ 带警告成功 | 🔴 失败 耗时: [X]秒 时间戳: [日期时间] 分支:(如果有) 提交记录:(如果有)

Metrics

指标

  • Errors: [N]
  • Warnings: [N]
  • Files processed: [N]
  • Files with issues: [N]

  • 错误数:[N]
  • 警告数:[N]
  • 处理文件数:[N]
  • 存在问题的文件数:[N]

📊 Executive Summary

📊 执行摘要

[2-3 sentence summary]
Impact: 🔴 CRITICAL | 🟡 HIGH | 🟢 MEDIUM | ⚪ LOW Recommendation: [Primary action]
[2-3句话的摘要]
影响级别: 🔴 严重 | 🟡 高 | 🟢 中 | ⚪ 低 建议: [首要操作]

Issues by Category

按类别划分的问题

CategoryErrorsWarningsPriority
Tool 1NN🔴
Tool 2NN🟡
类别错误数警告数优先级
工具1NN🔴
工具2NN🟡

Top 3 Issues

前3个问题

  1. [Error type] - [N] occurrences - 🔴 [Priority]
  2. [Error type] - [N] occurrences - 🟡 [Priority]
  3. [Error type] - [N] occurrences - 🟢 [Priority]

  1. [错误类型] - [N]次出现 - 🔴 [优先级]
  2. [错误类型] - [N]次出现 - 🟡 [优先级]
  3. [错误类型] - [N]次出现 - 🟢 [优先级]

🔴 Errors ([N] total)

🔴 错误(共[N]个)

[Tool]: [Error Type] ([N] errors)

[工具类型]:[错误类型](共[N]个错误)

Impact: [Description] Blocker: ✅ Yes | ❌ No
影响: [描述] 是否阻塞构建: ✅ 是 | ❌ 否

Error Group [N]: [Description] ([N] occurrences)

错误组[N]:[描述](共[N]次出现)

Pattern identified: [Explanation]

[file]:[line]:[col] - [code]: [message]
[file]:[line]:[col] - [code]: [message]
Files affected:
  • [file 1] (lines [X-Y])
  • [file 2] (lines [X-Y])
Solution:
  1. [Step 1]
  2. [Step 2]
Documentation:
  • [Link 1]
  • [Link 2]

识别到的模式: [说明]

[文件路径]:[行号]:[列号] - [错误代码]: [错误信息]
[文件路径]:[行号]:[列号] - [错误代码]: [错误信息]
受影响的文件:
  • [文件1](行[X-Y])
  • [文件2](行[X-Y])
解决方案:
  1. [步骤1]
  2. [步骤2]
文档链接:
  • [链接1]
  • [链接2]

⚠️ Warnings ([N] total)

⚠️ 警告(共[N]个)

[Similar structure as Errors]

[与错误部分结构类似]

🚀 Next Steps

🚀 后续步骤

Immediate Action (Critical)

紧急操作(严重优先级)

  1. ✅ [Action 1] - Estimated: [X]min
  2. ✅ [Action 2] - Estimated: [X]min
  1. ✅ [操作1] - 预计耗时:[X]分钟
  2. ✅ [操作2] - 预计耗时:[X]分钟

Backlog (Important)

待办事项(重要)

  • [Action 3]
  • [Action 4]
  • [操作3]
  • [操作4]

Useful Commands

实用命令

bash
undefined
bash
undefined

Re-run build

重新执行构建

[command]
[命令]

Auto-fix issues

自动修复问题

[command]
undefined
[命令]
undefined

9. Include Code Context (Optional)

9. 可选:添加代码上下文

For critical errors, show the problematic code:
markdown
**Code context:**
```typescript
// src/auth/login.ts:23
function handleLogin(userId: string) {
  const result = calculate(userId);  // ❌ Error here
  //                        ^^^^^^
  //                        Type 'string' not assignable to 'number'
  return result;
}
After fix:
typescript
function handleLogin(userId: string) {
	const result = calculate(Number(userId)); // ✅ Fixed
	return result;
}
undefined
针对严重错误,展示问题代码:
markdown
**代码上下文:**
```typescript
// src/auth/login.ts:23
function handleLogin(userId: string) {
  const result = calculate(userId);  // ❌ 错误位置
  //                        ^^^^^^
  //                        类型'string'无法分配给类型'number'
  return result;
}
修复后:
typescript
function handleLogin(userId: string) {
	const result = calculate(Number(userId)); // ✅ 已修复
	return result;
}
undefined

10. Suggest Configuration Improvements (Optional)

10. 可选:建议配置优化

Based on detected issues, suggest config changes:
markdown
undefined
根据检测到的问题,建议配置修改:
markdown
undefined

⚙️ Configuration Suggestions

⚙️ 配置建议

Based on recurring issues, consider:
  1. Enable TypeScript strict mode:
    json
    // tsconfig.json
    {
      "compilerOptions": {
        "strict": true,
        "noUnusedLocals": true
      }
    }

2. **Configure pre-commit hooks:**
   ```bash
   npm install --save-dev husky lint-staged
   npx husky add .husky/pre-commit "npm run lint"
   ```
基于重复出现的问题,建议:
  1. 启用TypeScript严格模式:
    json
    // tsconfig.json
    {
      "compilerOptions": {
        "strict": true,
        "noUnusedLocals": true
      }
    }

2. **配置提交前钩子:**
   ```bash
   npm install --save-dev husky lint-staged
   npx husky add .husky/pre-commit "npm run lint"
   ```

Report Format Template

报告格式模板

Quick reference template:
markdown
undefined
快速参考模板:
markdown
undefined

Build Report - [project-name]

构建报告 - [项目名称]

Result

结果

[STATUS emoji] + metrics
[状态表情] + 指标

Executive Summary

执行摘要

  • Impact level
  • Top 3 issues
  • Recommendation
  • 影响级别
  • 前3个问题
  • 建议

Errors (if any)

错误(如果有)

  • Grouped by pattern
  • With solutions
  • With documentation links
  • 按模式分组
  • 附带解决方案
  • 附带文档链接

Warnings (if any)

警告(如果有)

  • Grouped by priority
  • Quick fixes
  • 按优先级分组
  • 快速修复方案

Next Steps

后续步骤

  • Immediate actions
  • Backlog items
  • Useful commands
undefined
  • 紧急操作
  • 待办事项
  • 实用命令
undefined

Output

输出内容

The skill generates:
  • Structured Markdown report - Clear sections, collapsible if needed
  • Grouped issues - Similar errors together, not scattered
  • Prioritized actions - What to fix first
  • Documented solutions - How to fix each issue type
  • Useful commands - Ready to copy-paste
  • File locations - Exact line numbers
  • Comparison data - Optional comparison with previous builds
该技能生成以下内容:
  • 结构化Markdown报告:清晰的章节,支持折叠(如果需要)
  • 分组后的问题:相似错误归为一组,避免分散
  • 分优先级的操作:明确修复顺序
  • 有文档依据的解决方案:每种错误类型的修复方法
  • 实用命令:可直接复制使用
  • 文件位置:精确的行号
  • 对比数据:可选的与历史构建的对比数据

Examples

示例

Example 1: TypeScript Build Failed

示例1:TypeScript构建失败

Request: "Analyze this build output and generate a report"
Input (Build output):
bash
$ npm run build

> app@1.0.0 build
> tsc

src/auth/login.ts:23:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
src/auth/register.ts:45:20 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
src/utils/validate.ts:12:8 - error TS2304: Cannot find name 'User'.

Found 3 errors in 3 files.
Output (Generated report):
markdown
undefined
请求: "分析此构建输出并生成报告"
输入(构建输出):
bash
$ npm run build

> app@1.0.0 build
> tsc

src/auth/login.ts:23:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
src/auth/register.ts:45:20 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
src/utils/validate.ts:12:8 - error TS2304: Cannot find name 'User'.

Found 3 errors in 3 files.
输出(生成的报告):
markdown
undefined

Build Report - my-app

构建报告 - my-app

✅ Result: 🔴 FAILED

✅ 结果:🔴 失败

Status: FAILED Duration: 4.2s Errors: 3 Warnings: 0

状态: 失败 耗时: 4.2秒 错误数: 3 警告数: 0

📊 Executive Summary

📊 执行摘要

Build failed with 3 TypeScript errors in authentication module. All errors are type-related, suggesting recent type definition changes.
Impact: 🔴 CRITICAL - Project does not compile Recommendation: Fix type mismatch in auth module (2 errors), then add User import
构建失败,共3个TypeScript错误,均出现在认证模块中。所有错误均与类型相关,提示近期可能修改了类型定义。
影响: 🔴 严重 - 项目无法编译 建议: 先修复auth模块中的类型不匹配问题(2个错误),再添加User类型的导入

Issues by Category

按类别划分的问题

CategoryErrorsWarningsPriority
TypeScript30🔴 CRITICAL
类别错误数警告数优先级
TypeScript30🔴 严重

Top 3 Issues

前3个问题

  1. Type mismatch string→number - 2 occurrences - 🔴 CRITICAL
    • Affects: auth/login.ts, auth/register.ts
    • Solution: Convert userId to number or update function signature
  2. Cannot find name 'User' - 1 occurrence - 🔴 CRITICAL
    • Affects: utils/validate.ts
    • Solution: Add import for User type

  1. 类型不匹配 string→number - 2次出现 - 🔴 严重
    • 受影响文件:auth/login.ts、auth/register.ts
    • 解决方案:将userId转换为数字或更新函数签名
  2. 找不到名称'User' - 1次出现 - 🔴 严重
    • 受影响文件:utils/validate.ts
    • 解决方案:添加User类型的导入

🔴 Errors (3 total)

🔴 错误(共3个)

TypeScript: Type Mismatch (2 errors)

TypeScript:类型不匹配(2个错误)

Impact: Build blocker - function expects number but receives string Blocker: ✅ Yes
影响: 构建阻塞 - 函数期望number类型但接收了string类型 是否阻塞构建: ✅ 是

Error Group 1: string→number parameter (2 occurrences)

错误组1:string→number参数(2次出现)

Pattern identified: The
userId
parameter changed from string to number but callsites were not updated.

src/auth/login.ts:23:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
src/auth/register.ts:45:20 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
Files affected:
  • src/auth/login.ts (line 23)
  • src/auth/register.ts (line 45)
Solution:
  1. Option A: Convert to number before calling:
    typescript
    const result = calculate(Number(userId));
    // or
    const result = calculate(parseInt(userId, 10));

2. **Option B:** Update function to accept both types:

   ```typescript
   function calculate(id: string | number): Result {
   	const numericId = typeof id === "string" ? Number(id) : id;
   	// ...
   }
   ```

3. **Option C:** Update userId type at source:
   ```typescript
   const userId: number = getNumericUserId();
   ```

**Documentation:**

- [TypeScript Type Assertions](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions)
- [Type Compatibility](https://www.typescriptlang.org/docs/handbook/type-compatibility.html)

---
识别到的模式:
userId
参数从string类型改为number类型,但调用处未更新。

src/auth/login.ts:23:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
src/auth/register.ts:45:20 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
受影响的文件:
  • src/auth/login.ts(第23行)
  • src/auth/register.ts(第45行)
解决方案:
  1. 选项A: 调用前转换为数字:
    typescript
    const result = calculate(Number(userId));
    // 或
    const result = calculate(parseInt(userId, 10));

2. **选项B:** 更新函数以支持两种类型:

   ```typescript
   function calculate(id: string | number): Result {
   	const numericId = typeof id === "string" ? Number(id) : id;
   	// ...
   }
   ```

3. **选项C:** 修复源头的userId类型:
   ```typescript
   const userId: number = getNumericUserId();
   ```

**文档链接:**

- [TypeScript类型断言](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions)
- [类型兼容性](https://www.typescriptlang.org/docs/handbook/type-compatibility.html)

---

TypeScript: Missing Import (1 error)

TypeScript:缺失导入(1个错误)

Impact: Build blocker - type not found Blocker: ✅ Yes
影响: 构建阻塞 - 找不到类型定义 是否阻塞构建: ✅ 是

Error Group 2: Cannot find name 'User' (1 occurrence)

错误组2:找不到名称'User'(1次出现)

src/utils/validate.ts:12:8 - error TS2304: Cannot find name 'User'.
Files affected:
  • src/utils/validate.ts (line 12)
Solution:
Add the missing import at the top of the file:
typescript
import { User } from "@/types/user";
// or
import type { User } from "@/types/user";
If you're not sure where User is defined, search for it:
bash
git grep "export.*User" src/
Documentation:

src/utils/validate.ts:12:8 - error TS2304: Cannot find name 'User'.
受影响的文件:
  • src/utils/validate.ts(第12行)
解决方案:
在文件顶部添加缺失的导入:
typescript
import { User } from "@/types/user";
// 或
import type { User } from "@/types/user";
如果不确定User的定义位置,可搜索:
bash
git grep "export.*User" src/
文档链接:

🚀 Next Steps

🚀 后续步骤

Immediate Action (Critical)

紧急操作(严重优先级)

  1. ✅ Add User import in src/utils/validate.ts - Estimated: 1min
  2. ✅ Fix userId type in auth module (2 files) - Estimated: 5min
  1. ✅ 在src/utils/validate.ts中添加User导入 - 预计耗时:1分钟
  2. ✅ 修复auth模块中的userId类型问题(2个文件) - 预计耗时:5分钟

Useful Commands

实用命令

bash
undefined
bash
undefined

Re-run build

重新执行构建

npm run build
npm run build

Type check only (faster feedback)

仅执行类型检查(反馈更快)

npx tsc --noEmit
npx tsc --noEmit

See all type errors with details

查看所有带详细信息的类型错误

npx tsc --noEmit --pretty
undefined

npx tsc --noEmit --pretty
undefined

Example 2: ESLint Warnings Only

示例2:仅ESLint警告

Request: "Generate a build report focusing on code quality issues"
Input:
bash
$ npm run build

> app@1.0.0 build
> eslint src/ && webpack

src/components/Button.tsx
  12:7  warning  'handleClick' is defined but never used  @typescript-eslint/no-unused-vars
  23:10 warning  'styles' is assigned a value but never used  @typescript-eslint/no-unused-vars

2 problems (0 errors, 2 warnings)
1 problem (0 errors, 1 warning) potentially fixable with the `--fix` option.

webpack compiled successfully in 8.2s
Output:
markdown
undefined
请求: "生成聚焦代码质量问题的构建报告"
输入:
bash
$ npm run build

> app@1.0.0 build
> eslint src/ && webpack

src/components/Button.tsx
  12:7  warning  'handleClick' is defined but never used  @typescript-eslint/no-unused-vars
  23:10 warning  'styles' is assigned a value but never used  @typescript-eslint/no-unused-vars

2 problems (0 errors, 2 warnings)
1 problem (0 errors, 1 warning) potentially fixable with the `--fix` option.

webpack compiled successfully in 8.2s
输出:
markdown
undefined

Build Report - my-app

构建报告 - my-app

✅ Result: ⚠️ SUCCESS WITH WARNINGS

✅ 结果:⚠️ 带警告成功

Status: SUCCESS WITH WARNINGS Duration: 8.2s Errors: 0 Warnings: 2

状态: 带警告成功 耗时: 8.2秒 错误数: 0 警告数: 2

📊 Executive Summary

📊 执行摘要

Build completed successfully with 2 ESLint warnings. Both are unused variable warnings - can be auto-fixed.
Impact: 🟢 LOW - Build successful, code quality improvements available Recommendation: Run eslint --fix to auto-clean unused variables
构建成功完成,共2个ESLint警告。均为未使用变量警告,可自动修复。
影响: 🟢 低 - 构建成功,可优化代码质量 建议: 执行eslint --fix自动清理未使用变量

Issues by Category

按类别划分的问题

CategoryErrorsWarningsPriority
ESLint02🟢 MEDIUM

类别错误数警告数优先级
ESLint02🟢 中

⚠️ Warnings (2 total)

⚠️ 警告(共2个)

ESLint: Unused Variables (2 warnings)

ESLint:未使用变量(2个警告)

Impact: 🟢 LOW - Does not affect functionality but reduces code quality Auto-fixable: ⚠️ Partially (1/2 can be auto-fixed) Recommendation: Remove unused variables

src/components/Button.tsx:12:7 - warning: 'handleClick' is defined but never used (@typescript-eslint/no-unused-vars)
src/components/Button.tsx:23:10 - warning: 'styles' is assigned a value but never used (@typescript-eslint/no-unused-vars)
Solution:
Quick fix:
bash
undefined
影响: 🟢 低 - 不影响功能,但降低代码质量 可自动修复: ⚠️ 部分可修复(2个中有1个) 建议: 删除未使用的变量

src/components/Button.tsx:12:7 - warning: 'handleClick' is defined but never used (@typescript-eslint/no-unused-vars)
src/components/Button.tsx:23:10 - warning: 'styles' is assigned a value but never used (@typescript-eslint/no-unused-vars)
解决方案:
快速修复:
bash
undefined

Auto-fix what's possible

自动修复可修复的问题

npx eslint src/components/Button.tsx --fix

**Manual fix:**
If the variables will be used later, prefix with underscore:

```typescript
// Before
const handleClick = () => { ... };  // ❌ Warning

// After
const _handleClick = () => { ... };  // ✅ No warning
```

Or simply remove if truly unused:

```typescript
// Just delete the unused lines
```

**Documentation:**

- [ESLint no-unused-vars](https://eslint.org/docs/latest/rules/no-unused-vars)
- [TypeScript ESLint no-unused-vars](https://typescript-eslint.io/rules/no-unused-vars/)

---
npx eslint src/components/Button.tsx --fix

**手动修复:**
如果变量后续会使用,可添加下划线前缀:

```typescript
// 修复前
const handleClick = () => { ... };  // ❌ 警告

// 修复后
const _handleClick = () => { ... };  // ✅ 无警告
```

或者如果确定不再使用,直接删除:

```typescript
// 直接删除未使用的代码行
```

**文档链接:**

- [ESLint no-unused-vars](https://eslint.org/docs/latest/rules/no-unused-vars)
- [TypeScript ESLint no-unused-vars](https://typescript-eslint.io/rules/no-unused-vars/)

---

🚀 Next Steps

🚀 后续步骤

Nice-to-have (Improvements)

建议优化(提升代码质量)

  • Auto-fix unused variables with
    eslint --fix
  • Review if variables will be used soon (keep with
    _
    prefix)
  • 使用
    eslint --fix
    自动修复未使用变量
  • 检查变量是否后续会使用(如果是,添加
    _
    前缀保留)

Useful Commands

实用命令

bash
undefined
bash
undefined

Auto-fix all fixable issues

自动修复所有可修复的问题

npx eslint src/ --fix
npx eslint src/ --fix

Re-run lint

重新执行代码检查

npm run lint
npm run lint

Re-run build

重新执行构建

npm run build
undefined
npm run build
undefined

Resources

资源

Official Documentation (primary source for solutions):
Skill References:
  • references/nodejs-parsers.md - Parsing strategies for Node.js build tools
  • references/error-docs-map.md - Error code → official docs mapping
  • references/report-examples.md - Complete report examples
undefined
官方文档(解决方案的主要来源):
技能参考文档:
  • references/nodejs-parsers.md - Node.js构建工具的解析策略
  • references/error-docs-map.md - 错误代码→官方文档映射
  • references/report-examples.md - 完整的报告示例
undefined