# @stoplight/spectral-formatters

> This project exposes the available formatters from the CLI for users that perform custom validation through Javascript.

Latest version **1.5.1** (published 2026-04-13) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @stoplight/spectral-formatters
pnpm add @stoplight/spectral-formatters
yarn add @stoplight/spectral-formatters
bun add @stoplight/spectral-formatters
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2026-04-13 |
| First published | 2023-05-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^16.20 \|\| ^18.18 \|\| >= 20.17 |
| Dependencies | 13 |
| Unpacked size | 78.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3216 |
| Author | Stoplight |
| Maintainers | stoplight-spectral-bot |

## Links

- npm: https://www.npmjs.com/package/@stoplight/spectral-formatters
- Repository: https://github.com/stoplightio/spectral
- Issues: https://github.com/stoplightio/spectral/issues
- npm.io page: https://npm.io/package/@stoplight/spectral-formatters

## Dependencies (13)

- [chalk](https://npm.io/package/chalk.md) 4.1.2
- [cliui](https://npm.io/package/cliui.md) 7.0.4
- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [lodash](https://npm.io/package/lodash.md) ^4.18.1
- [strip-ansi](https://npm.io/package/strip-ansi.md) 6.0
- [text-table](https://npm.io/package/text-table.md) ^0.2.0
- [@stoplight/path](https://npm.io/package/@stoplight/path.md) ^1.3.2
- [markdown-escape](https://npm.io/package/markdown-escape.md) ^2.0.0
- [@stoplight/types](https://npm.io/package/@stoplight/types.md) ^13.15.0
- [node-sarif-builder](https://npm.io/package/node-sarif-builder.md) ^2.0.3
- [@types/markdown-escape](https://npm.io/package/@types/markdown-escape.md) ^1.1.3
- [@stoplight/spectral-core](https://npm.io/package/@stoplight/spectral-core.md) ^1.19.4
- [@stoplight/spectral-runtime](https://npm.io/package/@stoplight/spectral-runtime.md) ^1.1.2

## Recent versions

- 1.5.1 (latest) — 2026-04-13
- 1.5.0 — 2025-04-22
- 1.4.3 — 2024-11-19
- 1.4.2 — 2024-11-13
- 1.4.1 — 2024-11-12
- 1.4.0 — 2024-09-13
- 1.3.0 — 2023-09-14
- 1.2.0 — 2023-07-26
- 1.1.0 — 2023-06-09
- 1.0.0 — 2023-05-23

## README

# @stoplight/spectral-formatters

This project exposes the available formatters from the CLI for users that perform custom validation through Javascript.

## Usage

```ts
import { pretty } from "@stoplight/spectral-formatters";

const spectral = new Spectral();
// ...
const result = await spectral.run(document);

// You can also filter the results here.
const output = pretty(result);

console.error(output);
// ...
```

## Available formatters

### Common (available both in the browser and Node.js)

- json
- stylish
- junit
- html
- text
- teamcity
- markdown (example: [markdown_example.md](markdown_example.md))

### Node.js only

- pretty
- github-actions
- sarif
- gitlab
- code-climate

---
_Source: https://npm.io/package/@stoplight/spectral-formatters · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
