Registry / devops / eslint-formatter-stylish

eslint-formatter-stylish

JSON →
library9.0.1jsnpmunverified

Standalone package for ESLint's official 'stylish' formatter, extracted for use outside ESLint's core. Version 9.0.1 supports ESLint 9 and requires Node ^18.18.0 || ^20.9.0 || >=21.1.0. Ships TypeScript definitions. Useful for custom lint reporting or integrating ESLint output into other tools. Maintained as part of the eslint-formatters monorepo with minimal dependencies.

npm install eslint-formatter-stylish
INSTALL
IMPORT
SIG · ESLINT-FORMATTER-S
E
eslint-formatter-stylish
devopsjavascriptv9.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import stylish from 'eslint-formatter-stylish'
const stylish = require('eslint-formatter-stylish')
Package is ESM-only since v9. CommonJS require will fail.
ESLint formatter usage
const result = await eslint.lintText(code); const output = stylish(result.results);
stylish(result)
The formatter expects an array of ESLint result objects, not a raw string.
Type import
import type { LintResult } from 'eslint'; import stylish from 'eslint-formatter-stylish';
import stylish from 'eslint-formatter-stylish' without type
TypeScript users may need to import LintResult type separately.

Shows how to use the stylish formatter with ESLint's API to lint code and output formatted results.

import stylish from 'eslint-formatter-stylish'; import { ESLint } from 'eslint'; const eslint = new ESLint(); const results = await eslint.lintText('const x = 1;\n'); const output = stylish(results); console.log(output);
Debug
Known issues
breakingv9 is ESM-only: require() throws ERR_REQUIRE_ESM
fix
Use dynamic import() or switch to ESM in your project.
affects: >=9.0.0
breakingDropped support for Node < 18.18.0
fix
Upgrade Node to ^18.18.0 || ^20.9.0 || >=21.1.0
affects: >=9.0.0
gotchaThe formatter does not automatically include colors if stdout is not a TTY
fix
Use the `FORCE_COLOR=1` environment variable or ensure TTY.
affects: *
deprecatedVersions prior to 9.0.0 use CommonJS and the old ESLint 8 API
fix
Upgrade to v9 for ESLint 9 support.
affects: <9.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using require() on an ESM-only package (v9+)
fix
Use import or dynamic import()
TypeError: stylish is not a function
Passing incorrect arguments (e.g., single result object instead of array)
fix
Pass an array of result objects: stylish(results)
Cannot find module 'eslint-formatter-stylish'
Package not installed or not in node_modules
fix
npm install eslint-formatter-stylish
Upgrade
Version history
9.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
eslint-formatter-stylish — npm install eslint-formatter-stylish · libregistry