Skip to content

chore: lint with the pnpm monorepo's ESLint config - #79

Merged
zkochan merged 2 commits into
mainfrom
lint/pnpm-eslint-config
Oct 28, 2026
Merged

zkochan merged 2 commits into
mainfrom
lint/pnpm-eslint-config

Conversation

@zkochan

@zkochan zkochan commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Lints this repo with the same rules as the pnpm monorepo: @pnpm/eslint-config plus eslint-plugin-regexp's recommended config, mirroring the monorepo's eslint.config.mjs.

  • The shared config targets **/*.ts; here its entries are retargeted to **/*.js/**/*.mjs (and its test-file entry to **/*.test.mjs). Type-aware rules run via tsconfig.lint.json with allowJs.
  • Deviations, each commented in the config:
    • @typescript-eslint/explicit-module-boundary-types is off, because JS has no syntax for the types it asks for.
    • import-x/no-extraneous-dependencies is off: this is a set of scripts with one manifest.
    • no-floating-promises allows node:test's test()/describe(), same as the monorepo's override for its node:test suites.
  • Code changes:
    • Autofixes: quotes, node: protocol, import sorting, trailing commas, brace style.
    • Default exports are now named exports (benchmark, recordBenchmark, benchmarkNodeVersions, cmdsMap, nodeManagersMap).
    • void on the two fire-and-forget flushed().finally() calls in the latency proxy. Their queue never rejects.
    • The rethrown error in report() now carries cause.
    • Intentionally sequential awaits in loops (polling, serial measurements, zstd worker throttling) get eslint-disable-next-line no-await-in-loop -- <reason>, as the monorepo's directive rule requires.
  • Six files still exceed the size and shape limits (function length, cognitive complexity, nesting, bindings). They are listed in PENDING_SIZE_AND_SHAPE_REFACTOR, the same mechanism the monorepo uses, so the refactor can happen separately.
  • Adds pnpm run lint and a Lint workflow that runs lint and the tests on PRs and pushes to main.
  • Adds pnpm-workspace.yaml with allowBuilds: { unrs-resolver: true }, matching the monorepo's policy. Each pnpm fixture writes its own pnpm-workspace.yaml, so the benchmarks never walk up into this one.

Test plan

  • pnpm run lint passes
  • pnpm test passes (9/9)
  • All modules parse; the renamed named exports resolve

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Added automated checks for code changes submitted to the main branch or as pull requests.
    • Added project-wide linting configuration and a command to run lint checks.
  • Tests

    • Automated checks now include running the test suite alongside linting.

Lints the scripts with @pnpm/eslint-config and eslint-plugin-regexp, the
same rules the pnpm monorepo uses, retargeted from .ts to .js/.mjs.
Autofixable violations are fixed, default exports become named exports,
intentionally sequential awaits are disabled with a reason, and the files
that still exceed the size and shape limits are listed for a later
refactor, the way the monorepo does it. A workflow runs lint and the tests
on pull requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16972dac-c378-4007-886e-aeb21f77841e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
Walkthrough

The pull request adds ESLint configuration and CI checks, changes benchmark functions and maps to named exports, updates their callers, and applies Node.js import and lint-related changes across runtime modules.

Changes: Linting and benchmark module updates

Layer / File(s) Summary
Configure linting and CI
.github/workflows/lint.yml, eslint.config.mjs, package.json, pnpm-workspace.yaml, tsconfig.lint.json
Adds an ESLint configuration, lint script, dependencies, compiler settings, and workspace build permission. The workflow installs dependencies, then runs linting and tests on pushes to main and pull requests.
Update benchmark exports and callers
benchmarkFixture.js, benchmarkNodeVersions.js, benchmarkRegistry.js, commandsMap.js, index.js, nodeManagersMap.js, populatePnprCache.js, recordBenchmark.js
Changes benchmark functions and maps to named exports and updates their imports and call sites. The missing-versions-file error now retains the caught error as its cause.
Apply lint updates to runtime modules
latencyProxy.js, latencyProxy.test.mjs, mergeResults.js, pnprServer.js, pnprServer.test.mjs, setupPackageManagers.js
Updates built-in module specifiers, adds lint suppressions for awaited operations in loops, and reformats handlers without changing their described behavior. The proxy test renames a loop counter; the server test receives import spacing changes.

Priority: Pending latest changes

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: nikoladev

Merge Risk: Minimal · previous review 010c4

The current tracked files do not trigger the lint coverage concern, and CI dependencies are consistent. The change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the primary change: adding linting with the pnpm monorepo's ESLint configuration.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 18 functions across 15 files. (4 skipped: 4 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit with a checklist to fill,
I nibble through lint rules, quiet and still.
Named exports hop into place,
CI checks follow at a measured pace,
Then I thump at the green workflow’s hill.

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Lint benchmark scripts with pnpm’s shared ESLint rules

⚙️ Configuration changes ✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Apply pnpm’s shared lint rules to JavaScript, with documented exceptions for this repository.
• Align scripts with those rules while preserving intentionally sequential benchmark and polling
 work.
• Run lint and existing tests in CI; defer larger size-and-shape refactors.
Diagram

graph TD
  CI["Lint workflow"] --> CMD["Lint script"] --> CFG["ESLint config"] --> SRC["JS sources"]
  SHARED["pnpm rules"] --> CFG
  REGEXP["Regexp rules"] --> CFG
  PROJECT["Type-aware project"] --> CFG
  CI --> TESTS["Node tests"]
Loading
High-Level Assessment

Retargeting the shared configuration keeps lint policy aligned with the pnpm monorepo without maintaining a separate ruleset. The documented JavaScript exceptions and temporary size-and-shape exclusions keep adoption separate from a larger refactor.

Files changed (20) +1715 / -135

Refactor (12) +184 / -132
benchmarkFixture.jsAlign fixture runner style and exports +59/-58

Align fixture runner style and exports

• Converts the benchmark function to a named export and applies import, quote, and formatting rules.

benchmarkFixture.js

benchmarkNodeVersions.jsName the Node-version benchmark export +8/-6

Name the Node-version benchmark export

• Replaces the default export with a named export and aligns imports and quoting with lint rules.

benchmarkNodeVersions.js

benchmarkRegistry.jsAlign registry imports and document serial warm-up +11/-9

Align registry imports and document serial warm-up

• Updates the command-map import and documents why cache population awaits each fixture in sequence.

benchmarkRegistry.js

commandsMap.jsExpose commands through a named export +9/-9

Expose commands through a named export

• Exports 'cmdsMap' by name and applies trailing-comma formatting.

commandsMap.js

index.jsUpdate benchmark imports and preserve reporting error cause +20/-14

Update benchmark imports and preserve reporting error cause

• Switches callers to named exports, retains the original error as the cause of a reporting failure, and documents serial measurements.

index.js

latencyProxy.jsMark proxy cleanup promises as intentionally unawaited +23/-9

Mark proxy cleanup promises as intentionally unawaited

• Marks two fire-and-forget queue flushes with 'void', documents sequential startup polling, and applies import and brace rules.

latencyProxy.js

mergeResults.jsDocument serial result-file processing +9/-3

Document serial result-file processing

• Adds lint directives explaining sequential reads and writes, and aligns built-in imports.

mergeResults.js

nodeManagersMap.jsExpose Node managers through a named export +1/-1

Expose Node managers through a named export

• Replaces the default export with the named 'nodeManagersMap' export.

nodeManagersMap.js

pnprServer.jsDocument sequential server polling and worker throttling +24/-9

Document sequential server polling and worker throttling

• Explains intentional awaits in readiness checks and zstd worker processing, and applies import and brace rules.

pnprServer.js

populatePnprCache.jsUpdate command-map import and document serial warm-up +8/-5

Update command-map import and document serial warm-up

• Uses the named 'cmdsMap' export and explains why fixtures warm the shared registry one at a time.

populatePnprCache.js

recordBenchmark.jsName the benchmark recorder export +8/-6

Name the benchmark recorder export

• Exports 'recordBenchmark' by name, imports the renamed fixture benchmark, and aligns imports and string formatting.

recordBenchmark.js

setupPackageManagers.jsAlign package-manager setup imports +4/-3

Align package-manager setup imports

• Switches built-in imports to the 'node:' protocol and groups imports under the new rules.

setupPackageManagers.js

Tests (2) +8 / -3
latencyProxy.test.mjsDocument sequential keep-alive requests in proxy test +6/-3

Document sequential keep-alive requests in proxy test

• Explains why requests in the reuse test are awaited one at a time and aligns import formatting.

latencyProxy.test.mjs

pnprServer.test.mjsAlign server test imports with lint rules +2/-0

Align server test imports with lint rules

• Separates built-in, package, and local imports according to the new lint configuration.

pnprServer.test.mjs

Other (6) +1523 / -0
lint.ymlRun lint and tests in CI +21/-0

Run lint and tests in CI

• Adds a read-only workflow for pull requests and pushes to main. It installs from the frozen lockfile, then runs lint and the existing tests.

.github/workflows/lint.yml

eslint.config.mjsAdapt pnpm’s shared ESLint configuration to JavaScript +70/-0

Adapt pnpm’s shared ESLint configuration to JavaScript

• Retargets shared rules to JS and MJS files, adds recommended regexp rules, and documents repository-specific exceptions. Temporarily disables size-and-shape rules for six files pending separate refactors.

eslint.config.mjs

package.jsonAdd lint command and development dependencies +9/-0

Add lint command and development dependencies

• Adds 'pnpm run lint' and the shared config, ESLint, plugins, TypeScript, and Node types needed for linting.

package.json

pnpm-lock.yamlLock the new lint toolchain +1410/-0

Lock the new lint toolchain

• Records the new direct lint dependencies and their resolved transitive packages, including platform-specific resolver bindings.

pnpm-lock.yaml

pnpm-workspace.yamlPermit the resolver dependency build +2/-0

Permit the resolver dependency build

• Adds the workspace-level build allowance for 'unrs-resolver'.

pnpm-workspace.yaml

tsconfig.lint.jsonEnable type-aware linting of JavaScript +11/-0

Enable type-aware linting of JavaScript

• Defines a no-emit TypeScript project with 'allowJs' and Node types for the repository’s JS and MJS files.

tsconfig.lint.json

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔇 Additional comments: 1
tsconfig.lint.json-10-10: 1

10-10: Minor · Functional Correctness · Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Include nested JavaScript files in the lint project.

An unimported file such as scripts/check.js matches JS_FILES in eslint.config.mjs, but this project excludes it. Typed parsing then fails, so pnpm run lint and CI fail. Include nested JavaScript files, while excluding fixture and generated directories. (raw.githubusercontent.com)


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 30b1428a-7d4c-4697-b421-bd2dfb85a6d3
Commits

Reviewing files that changed from the base of the PR and between 375e527 and 010c4f0.

Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 19
  • .github/workflows/lint.yml
  • benchmarkFixture.js
  • benchmarkNodeVersions.js
  • benchmarkRegistry.js
  • commandsMap.js
  • eslint.config.mjs
  • index.js
  • latencyProxy.js
  • latencyProxy.test.mjs
  • mergeResults.js
  • nodeManagersMap.js
  • package.json
  • pnpm-workspace.yaml
  • pnprServer.js
  • pnprServer.test.mjs
  • populatePnprCache.js
  • recordBenchmark.js
  • setupPackageManagers.js
  • tsconfig.lint.json

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Review details
Context from checks skipped due to timeout: 4
  • GitHub Check: CodeQL
  • GitHub Check: CodeRabbit
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
CI failures not shown inline: 2

GitHub Actions: Lint / 0_lint.txt: chore: lint with the pnpm monorepo's ESLint config

Conclusion: failure

View job details

##[group]Running pnpm install --no-runtime...
 ? Verifying lockfile against supply-chain policies (229 entries)...
 Packages are hard linked from the content-addressable store to the virtual store.
   Content-addressable store is at: /home/runner/setup-pnpm/store/v11
   Virtual store is at:             node_modules/.pnpm
 ✗ Lockfile failed supply-chain policy check (229 entries in 1.3s)
 Lockfile is up to date, resolution step is skipped
 Error: ERR_PNPM_TARBALL_URL_MISMATCH
   × installing dependencies
   ╰─▶ 1 lockfile entries failed verification:
         @pnpm/eslint-config@1100.0.2 has a tarball URL (https://node-
       registry.bit.cloud/@pnpm/eslint-config/-/eslint-config-1100.0.2.tgz)
       that does not match the registry's published metadata (https://
       registry.npmjs.org/@pnpm/eslint-config/-/eslint-config-1100.0.2.tgz)
   help: The lockfile contains entries that pnpm cannot verify, whatever the
         configured policies. This can mean the lockfile is stale, or that it
         was tampered with — inspect recent changes to pnpm-lock.yaml before
         trusting it. If the changes look expected, run "pnpm clean --lockfile"
         and then "pnpm install" to rebuild from a fresh resolution.
 ##[endgroup]
 ##[error]pnpm install --no-runtime exited with status 1

GitHub Actions: Lint / lint: chore: lint with the pnpm monorepo's ESLint config

Conclusion: failure

View job details

##[group]Running pnpm install --no-runtime...
 ? Verifying lockfile against supply-chain policies (229 entries)...
 Packages are hard linked from the content-addressable store to the virtual store.
   Content-addressable store is at: /home/runner/setup-pnpm/store/v11
   Virtual store is at:             node_modules/.pnpm
 ✗ Lockfile failed supply-chain policy check (229 entries in 1.3s)
 Lockfile is up to date, resolution step is skipped
 Error: ERR_PNPM_TARBALL_URL_MISMATCH
   × installing dependencies
   ╰─▶ 1 lockfile entries failed verification:
         @pnpm/eslint-config@1100.0.2 has a tarball URL (https://node-
       registry.bit.cloud/@pnpm/eslint-config/-/eslint-config-1100.0.2.tgz)
       that does not match the registry's published metadata (https://
       registry.npmjs.org/@pnpm/eslint-config/-/eslint-config-1100.0.2.tgz)
   help: The lockfile contains entries that pnpm cannot verify, whatever the
         configured policies. This can mean the lockfile is stale, or that it
         was tampered with — inspect recent changes to pnpm-lock.yaml before
         trusting it. If the changes look expected, run "pnpm clean --lockfile"
         and then "pnpm install" to rebuild from a fresh resolution.
 ##[endgroup]
 ##[error]pnpm install --no-runtime exited with status 1
Additional context used
Learnings: 1
Learning: 2026-08-19T09:30:46.644Z
Learnt from: zkochan
Repo: pnpm/benchmarks PR: 61
File: mergeResults.js:63-91
Timestamp: 2026-08-19T09:30:46.644Z
Learning: In the benchmark repository, `LIMIT_RUNS` is defined in `recordBenchmark.js`. Do not import it from `index.js`, because `index.js` calls `run()` during module import and would start benchmark execution.

Applied to files:

  • index.js

@zkochan
zkochan merged commit f8d0f68 into main Oct 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant