Gathering detailed insights and metrics for eslint-rule-benchmark
Gathering detailed insights and metrics for eslint-rule-benchmark
Gathering detailed insights and metrics for eslint-rule-benchmark
Gathering detailed insights and metrics for eslint-rule-benchmark
🌩 Benchmark ESLint rules with detailed performance metrics for CI and plugin development
npm install eslint-rule-benchmark
Typescript
Module System
Min. Node Version
Node Version
NPM Version
63.1
Supply Chain
91.3
Quality
87.3
Maintenance
100
Vulnerability
97.6
License
TypeScript (100%)
Total Downloads
468
Last Day
7
Last Week
180
Last Month
468
Last Year
468
MIT License
18 Stars
47 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Jun 09, 2025
Minified
Minified + Gzipped
Latest Version
0.7.0
Package Id
eslint-rule-benchmark@0.7.0
Unpacked Size
98.96 kB
Size
27.79 kB
File Count
74
NPM Version
10.9.2
Node Version
22.15.0
Published on
May 25, 2025
Cumulative downloads
Total Downloads
ESLint Rule Benchmark times individual ESLint rules, capturing ops/sec, mean and median runtimes and rich latency percentiles to surface performance hotspots.
It helps you catch regressions and quantify optimization gains.
.ts
rules out of the box1npm install --save-dev eslint-rule-benchmark
benchmark/config.js
or benchmark/config.ts
:1import { defineConfig } from 'eslint-rule-benchmark'
2
3export default defineConfig({
4 tests: [
5 {
6 name: 'My Rule Performance',
7 ruleId: 'my-plugin/my-rule',
8 rulePath: '../rules/my-rule.js',
9 cases: [
10 {
11 testPath: './my-rule/base-case.js',
12 },
13 ],
14 },
15 ],
16})
1npx eslint-rule-benchmark run
By default, eslint-rule-benchmark run
will look for the config.{js,cjs,mts,ts,cts,mts}
configuration file in the ./benchmark/
directory.
The configuration file should export a configuration object, preferably using the defineConfig
helper for type safety and autocompletion.
1import { defineConfig } from 'eslint-rule-benchmark' 2 3export default defineConfig({ 4 /* Number of measurement iterations. Default: 1000. */ 5 iterations: 1000, 6 7 /* Warmup configuration. */ 8 warmup: { 9 /* Number of warmup iterations. Default: 100. */ 10 iterations: 100, 11 12 /* Whether to enable warmup. Default: true. */ 13 enabled: true, 14 }, 15 /* Max time per benchmark. Default: 5000. */ 16 timeout: 5000, 17 18 /* Array of benchmark test specifications. */ 19 tests: [ 20 { 21 /* Descriptive name for this test group/specification. */ 22 name: 'Rule: sort-imports', 23 24 /* ESLint rule identifier. */ 25 ruleId: 'sort-imports', 26 27 /* Path to the rule's implementation. */ 28 rulePath: '../lib/rules/sort-imports.ts', 29 30 /* Override global benchmark settings for this specific test group. */ 31 iterations: 50, 32 timeout: 300, 33 warmup: { 34 iterations: 10, 35 }, 36 37 /* Array of test cases for this rule. */ 38 cases: [ 39 { 40 testPath: './sort-imports/base-case.ts', 41 42 /* ESLint rule options specific to this case. */ 43 options: [{ order: 'asc', ignoreCase: true }], 44 45 /* ESLint rule severity for this case (0, 1, 2). Default: 2. */ 46 severity: 2, 47 }, 48 { 49 testPath: './sort-imports/complex-case.ts', 50 }, 51 ], 52 }, 53 { 54 name: 'Rule: sort-vars', 55 ruleId: 'sort-vars', 56 rulePath: '../lib/rules/sort-vars.ts', 57 cases: [ 58 { 59 testPath: './sort-vars/base-case.ts', 60 }, 61 ], 62 }, 63 /* ... more test specifications */ 64 ], 65})
ESLint Rule Benchmark provides the following performance metrics:
Metric | Description |
---|---|
Operations per second | Number of operations per second |
Average time | Average execution time of the rule (e.g., in ms) |
Median time (P50) | Median execution time (50th percentile) |
Minimum time | Minimum execution time |
Maximum time | Maximum execution time |
Standard deviation | Standard deviation (measure of time variability) |
Metrics are available in Console, JSON, and Markdown formats, allowing integration with various systems and workflows.
------------------------------------------------------------------------------------------------------
Rule: sort-imports
------------------------------------------------------------------------------------------------------
Sample | Ops/sec | Avg Time | Median | Min | Max | StdDev | Samples
base-alphabetical.ts | 7,569 ops/sec | 0.132 ms | 0.131 ms | 0.125 ms | 0.148 ms | ±0.004 ms | 7,421
base-natural.ts | 7,485 ops/sec | 0.134 ms | 0.132 ms | 0.126 ms | 0.151 ms | ±0.005 ms | 7,010
base-line-length.ts | 7,508 ops/sec | 0.133 ms | 0.131 ms | 0.125 ms | 0.150 ms | ±0.005 ms | 7,828
------------------------------------------------------------------------------------------------------
System Information:
Runtime: Node.js v22.15.1, V8 12.4.254.21-node.24, ESLint 9.25.1
Platform: darwin arm64 (24.5.0)
Hardware: Apple M1 Pro (10 cores, 2400 MHz), 32 GB RAM
ESLint Rule Benchmark automatically publishes benchmark results as comments to GitHub Pull Requests when running in GitHub Actions environment.
ESLint Rule Benchmark automatically posts benchmark results as comments on pull requests.
Create .github/workflows/benchmark.yml
:
1name: ESLint Rule Benchmark 2 3on: 4 pull_request: 5 types: [opened, synchronize] 6 7jobs: 8 benchmark: 9 runs-on: ubuntu-latest 10 permissions: 11 pull-requests: write 12 steps: 13 - uses: actions/checkout@v4 14 - uses: actions/setup-node@v4 15 with: 16 node-version: '20' 17 - run: npm ci 18 - name: Run benchmark 19 env: 20 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 21 run: npx eslint-rule-benchmark run
The tool uses Tinybench with warmup phases and outlier filtering for high accuracy.
The tool uses Tinybench for accurate and reliable benchmarking:
Yes! Native TypeScript support is included.
This plugin is following Semantic Versioning.
See Contributing Guide.
MIT © Azat S.
No vulnerabilities found.
No security vulnerabilities found.
Last Day
-87.9%
7
Compared to previous day
Last Week
25%
180
Compared to previous week
Last Month
0%
468
Compared to previous month
Last Year
0%
468
Compared to previous year