一键导入
eslint-log-capture
How to run ESLint and capture its output in a format that's easy for the AI agent to read and process, especially on Windows.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
How to run ESLint and capture its output in a format that's easy for the AI agent to read and process, especially on Windows.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | eslint-log-capture |
| description | How to run ESLint and capture its output in a format that's easy for the AI agent to read and process, especially on Windows. |
When dealing with a large number of ESLint warnings or errors, direct terminal output can be truncated, messy, or encoded in a way that's difficult to process. This skill provides a reliable method to capture ESLint output to a file and read it using native tools.
On Windows, using > or Out-File in PowerShell often defaults to UTF-16 (little-endian or big-endian depending on version), which can cause issues with the agent's view_file tool or other text processing tools that expect UTF-8.
Run the following command to pipe the linting output to a temporary file:
npm run lint -- --format stylish 2>&1 | Out-File -Encoding utf8 lint-raw.log
Note: In PowerShell 5.1, -Encoding utf8 creates a UTF-8 BOM file. In PowerShell Core/7, it's UTF-8 without BOM.
[!TIP] Linting can take several minutes to complete on a large codebase. Use a generous wait duration (e.g. 60 seconds) when checking the command status.
If the agent has trouble reading lint-raw.log, convert it using PowerShell to ensure it's standard UTF-8:
Get-Content lint-raw.log | Set-Content -Encoding utf8 lint.log
Once the file is created and confirmed to be in UTF-8, use your environment's file-reading tools (e.g., view_file, cat, or a similar tool) to process the linting results.
Example (using view_file):
{
"tool": "view_file",
"arguments": {
"AbsolutePath": "<ABSOLUTE_PATH_TO_REPO>/lint.log"
}
}
stylish or json formats are usually best for agent processing.lint-raw.log, lint.log) once the issues are resolved.