@cspell/cspell-json-reporter

中文文档
10.4.1发布于 2026/11/07MITTypeScriptES Module构建来源已验证近 30 天下载 704.7万

JSON reporter for CSpell

原始使用文档
文档目录6 节
  1. Installation
  2. Usage
  3. Using Command Line
  4. Using CSpell Configuration
  5. Output file format
  6. Settings

@cspell/cspell-json-reporter

CSpell reporter with JSON output

Installation

Install it as a development package in the repository that will use it.

npm install -SD @cspell/cspell-json-reporter

Usage

Using Command Line

cspell . --reporter @cspell/cspell-json-reporter

Using CSpell Configuration

Add this to cspell.yaml:

reporters: [['@cspell/cspell-json-reporter', { outFile: 'out.json' }]]

or cspell.json

{
  "reporters": [["@cspell/cspell-json-reporter", { "outFile": "out.json" }]]
}

Output file format

@cspell/cspell-json-reporter emits a JSON file with the following fields:

  • issues - found spelling issues
  • result - CSpell linting results
  • error - CSpell error messages
  • progress - file linting progress messages if settings.progress is enabled
  • info - CSpell execution logs if settings.verbose is enabled
  • debug - CSpell debug logs if settings.debug is enabled
JSON Output Definition
import type {
  ErrorLike,
  Issue,
  MessageType,
  ProgressFileComplete,
  ProgressItem,
  RunResult
} from '@cspell/cspell-types';

export type CSpellJSONReporterOutput = {
  /**
   * Found spelling issues
   */
  issues: Array<Issue>;
  /**
   * CSpell execution logs
   */
  info?: Array<{ message: string; msgType: MessageType }>;
  /**
   * CSpell debug logs
   */
  debug?: Array<{ message: string }>;
  /**
   * CSpell error logs
   */
  error?: Array<{ message: string; error: ErrorLike }>;
  /**
   * CSpell file progress logs
   */
  progress?: Array<ProgressItem | ProgressFileComplete>;
  /**
   * Execution result
   */
  result: RunResult;
};

Settings

Possible settings:

  • outFile (default: stdout) - path for JSON file to emit
  • verbose (default: false) - enable saving of execution logs
  • verboseLevel - level of verbosity (higher number = more verbose)
  • debug (default: false) - enable saving of debug logs
  • progress (default: false) - enable saving of file progress logs
Reporter Settings
/**
 * CSpell-json-reporter settings type definition
 */
export type CSpellJSONReporterSettings = {
  /**
   * Path to the output file.
   *
   * Relative paths are relative to the current working directory.
   *
   * Special values:
   * - `stdout` - write the JSON to `stdout`.
   * - `stderr` - write the JSON to `stderr`.
   *
   * @default stdout
   */
  outFile?: string;
  /**
   * Add more information about the files being checked and the configuration
   */
  verbose?: boolean;
  /**
   * Level of verbosity (higher number = more verbose).
   */
  verboseLevel?: number;
  /**
   * Add information useful for debugging cspell.json files
   * @default false
   */
  debug?: boolean;
  /**
   * Add progress messages
   * @default false
   */
  progress?: boolean;
};

版本与发布记录

@cspell/cspell-json-reporter 共发布 273 个版本,首次发布于 2021/09/13;过去 12 个月发布了 39 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
10.4.1latest2026/11/074 天前
10.4.02026/10/1427 天前
10.4.0-alpha.1next2026/10/011 个月前
10.3.62026/09/291 个月前
10.3.52026/09/281 个月前
10.3.42026/09/251 个月前

其他发布通道:cspell5-next → 5.21.2-alpha.0,cspell5 → 5.21.2,next → 10.4.0-alpha.1。

关于 @cspell/cspell-json-reporter 的常见问题

@cspell/cspell-json-reporter 是什么?

JSON reporter for CSpell

如何安装 @cspell/cspell-json-reporter?

在项目目录运行 npm install @cspell/cspell-json-reporter,或使用 pnpm add / yarn add / bun add。

@cspell/cspell-json-reporter 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cspell/cspell-json-reporter 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cspell/cspell-json-reporter 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.18.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cspell/cspell-json-reporter 可以商用吗?

@cspell/cspell-json-reporter 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cspell/cspell-json-reporter 的下载量有多少?

根据 npm 官方下载统计,@cspell/cspell-json-reporter 在 2026/10/11 – 2026/11/09 这 30 天内被下载 7,047,412 次,日均约 234,914 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cspell/cspell-json-reporter 还在维护吗?

最新版本 10.4.1 发布于 2026/11/07(4 天前);至今共发布 273 个版本,其中过去 12 个月发布了 39 个;首次发布于 2021/09/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。