Socket
Book a DemoInstallSign in
Socket

@push-based/eslint-stats

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@push-based/eslint-stats

---

latest
npmnpm
Version
0.38.2
Version published
Maintainers
2
Created
Source

@push-based/eslint-stats

ESLint Performance Analysis and Reporting

The @push-based/eslint-stats package provides tools and utilities for collecting, and analyzing ESLint timing profiles. Measure, sort, filter, print, voilà.

Features

  • ESLint Performance Analysis:
    • Analyze ESLint timing statistics from a JSON file.
    • Group results by rule, file, or a combination of file and rule.
    • Sort the aggregated results by time consumption or violation count.
    • Interactive mode to dynamically explore the timing data.
    • Export analysis results to a Markdown file for documentation and sharing.
  • TypeScript API:
    • Programmatic access to all core features.
    • Use it in your own tools and workflows.

How to Generate ESLint Stats

To create ESLint output you just execute it

npx eslint .

This generates the following output:

/Users/user/project/path/to/e2e-setup.ts
  42:28  warning  '_' is defined but never used  @typescript-eslint/no-unused-vars

/Users/user/project/path/to/process.ts
  200:3  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions
  41:25  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  214:5  error  Definition for rule 'functional/no-let' was not found                  functional/no-let

✖ 38 problems (8 errors, 30 warnings)
  0 errors and 3 warnings potentially fixable with the `--fix` option.

The top part is a listing of all files and its issues, followed by a summary of the total number of problems found, including errors and warnings.

To analyze your ESLint performance, you first need to generate a statistics file. You can do this by running ESLint with the --stats flag and formatting the output as JSON.

# Options:
# Output:
#   `-o`, `--output-file` path::String   Specify file to write report to
#   `-f`, `--format` String              Use a specific output format - default: stylish
# Miscellaneous:
#  `--stats`                          Add statistics to the lint report - default: false
#  `--format` String              Use a specific output format - default: stylish
# $ command [...args] -o <file-path> -f json --stats
npx eslint . -o eslint-stats.json -f json --stats

You can add an environment variable to use eslints native printing to see [N] results in the terminal. And optionally, skip the output file and use the native printing.

# Environment:
# `TIMING` Number  Prints aggregated rule timing stats in the terminal - default: 10
# $ENV_VAR command [...args] --stats
TIMING=true npx eslint . --stats
TIMING=10 npx eslint . --stats
TIMING=all npx eslint . --stats

Installation

npm install @push-based/eslint-stats

CLI Usage

This guide provides instructions for using the @push-based/eslint-stats CLI.

measure command

Usage:

npx @push-based/eslint-stats measure [args...] [options...]

Description: Runs ESLint on a given set of files and measures timing stats. This command is a wrapper around the ESLint CLI, adding the ability to capture timing statistics.

Arguments:

ArgumentTypeDescription
[args...]string[]Arguments for ESLint, e.g., files, globs, or commands like nx run my-app:lint. If omitted, ESLint runs on the current directory.

ESLint Options:

OptionAliasTypeDescription
--config-cstringPath to the ESLint config file.
--output-file-ostringFile to write the ESLint output to.

Stats Options:

OptionTypeDefaultDescription
--report-pathstringFile to write the stats to.
--showbooleantrueShow the stats report after running the command.
--interactivebooleantrueShow the stats report as an interactive table.

Examples:

  • eslint-stats measure "src/**/*.ts" - Lint all TypeScript files in the src directory.
  • eslint-stats measure "src/**/*.ts" --config ./.eslintrc.ci.js --output-file eslint-report.json - Lint files with a specific config and output file.
  • eslint-stats measure "src/**/*.ts" --file-output stats.json - Lint files and save performance statistics to stats.json.
  • eslint-stats measure nx run project-name:lint - Lint files using a command.

analyse command

Usage:

npx @push-based/eslint-stats analyse <file> [options...]

Description: Analyzes an ESLint statistics JSON file to provide insights into rule performance and violation counts. It can display the results in the console or save them to a Markdown file. An interactive mode is available for a more dynamic analysis experience.

Arguments:

ArgumentTypeDescription
<file>stringPath to the ESLint stats JSON file

Options:

OptionAliasTypeDefaultDescription
--groupBy-gstringruleGroup by "rule", "file", or "file-rule". Choices: rule, file, file-rule.
--sortBy-sstringtimeSort by "time" or "violations". Choices: time, violations.
--sortDirection-dstringdescSort direction "asc" or "desc". Choices: asc, desc.
--take-tarrayThe number of entries to display. For file-rule group, two values can be provided for files and rules.
--outPathstringPath to the output file. Defaults to the input file name with a .md extension.
--interactivebooleantrue (if TTY)Interactive mode to dynamically explore the performance data.

Examples:

  • eslint-stats analyse ./eslint-stats.json - Analyze the stats file with default options.
  • eslint-stats analyse ./eslint-stats.json --groupBy file - Group the statistics by file.
  • eslint-stats analyse ./eslint-stats.json --sortBy violations - Sort the results by the number of violations.
  • eslint-stats analyse ./eslint-stats.json --groupBy file-rule --take 5 3 - Display only the top 5 files and top 3 files and 3 rules.
  • eslint-stats analyse ./eslint-stats.json --outPath ./performance-report.md - Save the analysis to a Markdown file.

Interactive Mode

When you run the analyse command in an interactive terminal, it will start in interactive mode by default. This mode allows you to change the grouping, sorting, and other options on the fly by pressing keys, providing a powerful way to explore your ESLint performance data without re-running the command multiple times.

Total Stats

📊 Total: 📁 52 files • ⚙️ 3224 rules • ⚡ 278.63ms (parse: 110.65ms, rules: 89.00ms, fix: 0.00ms, other: 78.98ms) 🚨 7 errors • ⚠️ 21 warnings • 🔧 6 fixable

Keybindings
  • ←/→ - Sort ←/→: time or violations
  • ↑/↓ - Order ↑/↓: asc or desc
  • +/- - Rows: 10 (File or Rule) or 5 3 (File and Rule)
    • F/R - F:10, R:10: File or Rule
  • Tab - Group: rule or file or file-rule
  • Enter - Write to report-output: <eslint-stats-file-name>.md
  • Ctrl+C - Quit: Ctrl+C
Table View

The table view is a dynamic view of the stats data. It is updated in real-time as you change the options. The data is color graded, and ensiched with small ascii charts.

📁 File → ⚙️ Rule📁 File⚙️ Rule
eslint-stats--file-rule-view.pngeslint-stats--file-view.pngeslint-stats--rule-view.png

When you hit the enter key, the current stta is sent to a mark-down file. This is useful to share findings with your team.

📁 File → ⚙️ Rule⚡ Time ↓% ↓🚨 Errors⚠️ Warnings
.../eslint-stats/eslint.config.mjs▄▂▁▃ 20.57 ms7.4%00
- @typescript-eslint/no-unused-vars2.03 ms9.9%00
- @typescript-eslint/triple-slash-reference0.20 ms1.0%00
.../bin/eslint-stats-command.integration.test.ts▄▄▁▂ 18.36 ms6.6%11
- @nx/enforce-module-boundaries4.87 ms26.5%10
- @typescript-eslint/no-unused-vars1.35 ms7.4%01
.../stats/eslint-stats-table.ts▅▂▁▂ 17.15 ms6.2%20
- @typescript-eslint/no-unused-vars1.21 ms7.0%00
- @nx/enforce-module-boundaries0.75 ms4.4%00
.../eslint-stats/package.json▁▇▁▁ 15.76 ms5.7%20
- @nx/dependency-checks13.56 ms86.0%20
.../analyse/interactive.ts▅▂▁▂ 14.72 ms5.3%06
- @typescript-eslint/no-unused-vars1.21 ms8.2%04
- @nx/enforce-module-boundaries1.07 ms7.2%02

Additional Resources

  • ESLint Command Line Interface - Official ESLint CLI documentation.
  • ESLint Timing - Usage instructions for the stats flag.

Group: Rule

⚙️ 3224 rules • ⚡ 89.00ms 🚨 7 errors • ⚠️ 21 warnings • 🔧 6 fixable

Group: File

📁 52 files • ⚡ 278.63ms ▄▂▁▃ (parse: 110.65ms, rules: 89.00ms, fix: 0.00ms, other: 78.98ms) 🚨 7 errors • ⚠️ 21 warnings • 🔧 6 fixable

Group: File->Rule

📁 52 files • ⚙️ 3224 rules • ⚡ 278.63ms ▄▂▁▃ (parse: 110.65ms, rules: 89.00ms, fix: 0.00ms, other: 78.98ms) 🚨 7 errors • ⚠️ 21 warnings • 🔧 6 fixable

FAQs

Package last updated on 16 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.