{"id":19649,"library":"eslint-formatter-pretty","title":"eslint-formatter-pretty","description":"A pretty formatter for ESLint that provides aesthetically pleasing output with syntax highlighting, clickable hyperlinks for filenames and rule IDs, and severity-sorted results. Version 7.1.0 is the latest stable release, released in 2025, with a cadence of major breaking changes tied to Node.js version bumps. It ships TypeScript types and is maintained by Sindre Sorhus. Key differentiators: stylish output with inline codeblock styling, open-in-editor support for filenames, and rule doc links. Alternatives like `eslint-formatter-codeframe` focus on code frames without the visual polish.","status":"active","version":"7.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/sindresorhus/eslint-formatter-pretty","tags":["javascript","eslint","eslint-formatter","formatter","reporter","lint","validate","typescript"],"install":[{"cmd":"npm install eslint-formatter-pretty","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-formatter-pretty","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-formatter-pretty","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; this package formats ESLint results and must be used alongside ESLint.","package":"eslint","optional":false}],"imports":[{"note":"Since v6, the package is ESM-only. Use import syntax. CommonJS require will not work.","wrong":"const eslintFormatterPretty = require('eslint-formatter-pretty');","symbol":"default","correct":"import eslintFormatterPretty from 'eslint-formatter-pretty';"},{"note":"For projects still on ESLint v8, avoid v6+; use v5 with require('eslint-formatter-pretty') instead.","wrong":"","symbol":"default (CommonJS)","correct":"import eslintFormatterPretty from 'eslint-formatter-pretty';"}],"quickstart":{"code":"// Quick start: run ESLint with the pretty formatter\n// Install: npm install --save-dev eslint eslint-formatter-pretty\n// Then run: eslint --format=pretty src/\n\n// Example to use programmatically:\nimport eslint from 'eslint';\nimport eslintFormatterPretty from 'eslint-formatter-pretty';\n\nasync function lintAndFormat() {\n  const engine = new eslint.ESLint();\n  const results = await engine.lintFiles(['src/']);\n  const formatted = eslintFormatterPretty(results);\n  console.log(formatted);\n}\n\nlintAndFormat().catch(console.error);","lang":"typescript","description":"Shows how to use ESLint programmatically with the pretty formatter, including installation and CLI usage."},"warnings":[{"fix":"If using ESLint <9, install eslint-formatter-pretty@5 instead.","message":"v6 requires Node.js 18 and ESLint v9+. ESLint v8 users must stick to v5.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Upgrade Node.js to 20 or use v6 which supports Node.js 18.","message":"v7 drops Node.js 18 support; requires Node.js 20.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Upgrade to v6+ if using ESLint 9+, else stick with v5.","message":"v5 is deprecated; it only receives critical security fixes.","severity":"deprecated","affected_versions":">=5.0.0 <6.0.0"},{"fix":"Use dynamic import() or add 'type': 'module' to package.json.","message":"The package is ESM-only from v6 onwards; require() will fail.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Use a compatible terminal or rely on standard text output.","message":"Clickable hyperlinks for filenames and rule IDs only work in terminals with hyperlink support (e.g., iTerm2, VSCode terminal).","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import() or set 'type': 'module' in package.json.","cause":"ESM-only package imported with require() in a CommonJS context.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Run: npm install --save-dev eslint","cause":"eslint is a peer dependency and must be installed separately.","error":"Error: Cannot find module 'eslint'"},{"fix":"Use: import eslintFormatterPretty from 'eslint-formatter-pretty';","cause":"Wrong import style (e.g., named import instead of default).","error":"TypeError: eslintFormatterPretty is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}