ESLint Table Formatter

raw JSON →
7.32.1 verified Sat Apr 25 auth: no javascript maintenance

ESLint's official `table` formatter, extracted from ESLint 7 as a standalone package. Version 7.32.1 is a direct extract from ESLint 7.x and is not actively maintained. This formatter was removed from ESLint 8, so this package provides compatibility for projects still on ESLint 7 or those who prefer the table output. Key differentiator: outputs a formatted table with results per file, showing line, column, type, message, and rule ID. No longer part of ESLint core, so requires separate installation.

error TypeError: table is not a function
cause Incorrect import: using const table = require('eslint-formatter-table') in CommonJS without .default.
fix
Use const table = require('eslint-formatter-table').default
error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
cause Package is ESM-only and cannot be required directly in CommonJS without type: module or .mjs extension.
fix
Use import() or set type: 'module' in package.json, or use require('...').default with a bundler that supports ESM.
error Cannot find module 'eslint-formatter-table'
cause Package not installed or not present in node_modules.
fix
Run npm install --save-dev eslint-formatter-table
breaking This package is not maintained and may not work with ESLint 8+.
fix Use ESLint's built-in formatters or consider migrating to a different formatter if on ESLint 8.
deprecated ESLint 8 removed the built-in table formatter. This package fills the gap for ESLint 7 compatibility.
fix If using ESLint 7, this package is fine. For ESLint 8, use a different formatter or fork this package.
gotcha ESM-only package: Node.js must be 12+ and import/require must handle ESM correctly.
fix Use import syntax or CommonJS with require('...').default as shown in imports.
gotcha The formatter expects results in the same format as ESLint 7. Output format may differ if ESLint internals change.
fix Ensure your lint results are compatible. Test after upgrading ESLint.
breaking Package is not maintained; there may be unfixed bugs or security issues.
fix Consider forking or using an alternative formatter.
npm install eslint-formatter-table
yarn add eslint-formatter-table
pnpm add eslint-formatter-table

Shows how to use the table formatter via CLI, config file, and programmatic API with ESM imports.

// .eslintrc.js
module.exports = {
  formatter: 'table',
};

// Or CLI:
// eslint --format table src/

// Programmatic usage (ESM):
import table from 'eslint-formatter-table';
import { ESLint } from 'eslint';

const eslint = new ESLint({
  overrideConfig: {
    rules: { 'no-unused-vars': 2 },
  },
});

(async () => {
  const results = await eslint.lintText('const x = 1;\n');
  console.log(table(results));
})();