@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
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 issuesresult
- CSpell linting resultserror
- CSell error messagesprogress
- file linting progress messages if settings.progress
is enabledinfo
- CSpell execution logs if settings.verbose
is enableddebug
- 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 = {
issues: Array<Issue>;
info?: Array<{ message: string; msgType: MessageType }>;
debug?: Array<{ message: string }>;
error?: Array<{ message: string; error: ErrorLike }>;
progress?: Array<ProgressItem | ProgressFileComplete>;
result: RunResult;
};
Settings
Possible settings:
outFile
(required) - path for JSON file to emitverbose
(default: false) - enable saving of execution logsdebug
(default: false) - enable saving of debug logsprogress
(default: false) - enable saving of file progress logs
Reporter Settings
export type CSpellJSONReporterSettings = {
outFile?: string;
verbose?: boolean;
debug?: boolean;
progress?: boolean;
};