Skip to content

chore: lint with the ESLint rules pnpm/pnpm and get-pnpm use - #91

Merged
zkochan merged 2 commits into
mainfrom
eslint
Oct 24, 2026
Merged

zkochan merged 2 commits into
mainfrom
eslint

Conversation

@zkochan

@zkochan zkochan commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Sets up the same ESLint rules as pnpm/pnpm and get-pnpm (pnpm/get.pnpm.io).

Config

  • eslint.config.mjs uses @pnpm/eslint-config plus eslint-plugin-regexp's flat/recommended, like both repos. tsconfig.lint.json is the project the type-aware rules read.
  • JavaScript tests. The shared config only matches **/*.ts, and this repo's tests are .mjs. Its .ts blocks are reused for **/*.mjs with tseslint.configs.disableTypeChecked, so the tests get the same style, import and naming rules, minus the ones that need type information (including pnpm's conditions/no-object-methods-on-map). Dev dependencies are allowed in *.test.mjs and the config file, and the config file may export its default.
  • pnpm run lint lints src/**/*.ts, src/**/*.mjs and the config itself. A new lint job in pr-check.yaml runs it.

TypeScript 7

typescript-eslint needs TypeScript's compiler API, which TypeScript 7.0 does not ship (it refuses to run: "typescript-eslint does not support TS 7.0"). Following the TypeScript 7.0 release notes:

  • typescript is aliased to @typescript/typescript6, the 6.0 compatibility package that tools importing typescript resolve;
  • @typescript/native is aliased to typescript@^7.0.2, so tsc (used by update-dependencies.yaml) is still 7.0.2.

pnpm/pnpm does the equivalent with typescript@6.0.3 plus @typescript/native-preview.

Fixes

  • Relative imports carry their extension (./download.js, ../inputs/index.js), per import-x/extensions. The test stubs that match import specifiers follow.
  • Default exports are replaced with named ones.
  • Exported functions declare their return types.
  • Builtins use the node: prefix.
  • An error thrown from a catch keeps its cause.
  • The node:test context parameter t is renamed to testContext, and single-letter loop variables are renamed.
  • Intentionally sequential awaits in loops and the process.exit() in flushAndExit carry disable directives with a reason, which the shared config requires.
  • Functions over the size and shape limits are split rather than exempted:
    • packageManagerManifest: workspace root lookup, membership check and root manifest selection;
    • readEnvDocument: a lazy chunk generator and a separator scan;
    • runSelfInstaller: version spec selection;
    • resolveRuntimeRequests: an explicit runtime;
    • readNodeVersionFile: reading one candidate, and lts/ selectors in normalizeNodeVersion;
    • runPnpmInstall: arguments, the required-lockfile check, and result reporting.
  • Everything else is formatting from --fix: a space before function parentheses, no trailing comma in parameter lists, import order and quotes.

The bundle is rebuilt. Lint, tsc --noEmit (7.0.2) and all 138 tests pass.

This conflicts with #90 in src/install-runtime/. Whichever lands second needs a rebase and a pnpm run lint --fix.

🤖 Generated with Claude Code

Adds @pnpm/eslint-config with eslint-plugin-regexp's recommended rules,
the same setup as pnpm/pnpm and get-pnpm, and a `pnpm run lint` script
and a lint job in pr-check. The shared config only covers TypeScript, so
its rules are applied to the JavaScript tests as well, without the ones
that need type information.

typescript-eslint needs TypeScript's compiler API, which TypeScript 7.0
does not ship. Following the TypeScript 7.0 release notes, `typescript`
is now the 6.0 compatibility package and `@typescript/native` provides
7.0's `tsc`, which the type check still runs.

The violations are fixed: relative imports carry their extension,
modules use named exports, exported functions declare return types, and
the rest is formatting. Six files that exceed the size and shape limits
are listed in PENDING_SIZE_AND_SHAPE_REFACTOR, as pnpm/pnpm does, until
they are refactored.

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

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 2d237e17-c637-4a8e-a8e4-fc7337b38e87
Commits

Reviewing files that changed from the base of the PR and between 1790073 and 98daeca.

Files ignored due to path filters: 2
  • dist/index.js is excluded by !**/dist/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 42
  • .github/workflows/pr-check.yaml
  • eslint.config.mjs
  • package.json
  • pnpm-workspace.yaml
  • src/cache-restore/index.ts
  • src/cache-restore/keys.test.mjs
  • src/cache-restore/keys.ts
  • src/cache-restore/run.test.mjs
  • src/cache-restore/run.ts
  • src/cache-save/index.ts
  • src/cache-save/run.ts
  • src/flush-and-exit.test.mjs
  • src/flush-and-exit.ts
  • src/index.ts
  • src/inputs/index.ts
  • src/install-pnpm/download.ts
  • src/install-pnpm/index.ts
  • src/install-pnpm/locked-version.test.mjs
  • src/install-pnpm/locked-version.ts
  • src/install-pnpm/project.test.mjs
  • src/install-pnpm/project.ts
  • src/install-pnpm/registry.test.mjs
  • src/install-pnpm/registry.ts
  • src/install-pnpm/run.test.mjs
  • src/install-pnpm/run.ts
  • src/install-runtime/index.ts
  • src/install-runtime/installed-versions.test.mjs
  • src/install-runtime/node-version-file.test.mjs
  • src/install-runtime/node-version-file.ts
  • src/install-runtime/runtime-requests.test.mjs
  • src/lockfile-verification-cache/index.test.mjs
  • src/lockfile-verification-cache/index.ts
  • src/outputs/index.ts
  • src/pnpm-commands.test.mjs
  • src/pnpm-install/index.ts
  • src/pnpm-install/lockfile.test.mjs
  • src/pnpm-install/lockfile.ts
  • src/pnpm-store-prune/index.ts
  • src/store-fingerprint/index.test.mjs
  • src/store-fingerprint/index.ts
  • src/windows-path/index.ts
  • tsconfig.lint.json
  • 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

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Enforce pnpm ESLint rules across source and tests

⚙️ Configuration changes ✨ Enhancement 🕐 40+ Minutes

Grey Divider

AI Description

• Add shared pnpm ESLint rules for TypeScript source and JavaScript tests, with documented
 exemptions for oversized files.
• Run lint in PR checks and use TypeScript 6 for lint tooling while retaining TypeScript 7’s
 compiler.
• Align imports, exports, return types, and formatting with the rules without restructuring existing
 workflows.
Diagram

graph TD
  CI["PR lint job"] --> Script["lint script"] --> Config["ESLint config"] --> Shared["pnpm rules"] --> Files["Source files"]
  Config --> JS["MJS overrides"] --> Files
  Config --> Project["lint project"] --> TS6["TS 6 API"]
Loading
High-Level Assessment

Keep the shared pnpm configuration and targeted MJS overrides: duplicating the rule set would add maintenance cost, while restructuring six complex files solely to enable lint would broaden this PR. The TypeScript 6 API and TypeScript 7 compiler split addresses the tooling incompatibility without dropping the existing compiler.

Files changed (43) +1993 / -359

Bug fix (1) +11 / -10
node-version-file.tsPreserve the cause of version-file errors +11/-10

Preserve the cause of version-file errors

• Includes the original read error as the cause when an explicit version file is missing. Also normalizes a regular expression and module imports for lint.

src/install-runtime/node-version-file.ts

Refactor (22) +225 / -214
index.tsNormalize cache restore imports and exports +6/-6

Normalize cache restore imports and exports

• Adds extensions to relative imports and removes the default export in favor of the existing named function.

src/cache-restore/index.ts

keys.tsNormalize cache key module syntax +13/-12

Normalize cache key module syntax

• Uses node-prefixed and extension-qualified imports and applies function formatting.

src/cache-restore/keys.ts

run.tsNormalize cache restore implementation imports +23/-21

Normalize cache restore implementation imports

• Uses node-prefixed and extension-qualified imports, adds explicit exported return types, and applies lint formatting.

src/cache-restore/run.ts

index.tsUse a named cache save export +4/-5

Use a named cache save export

• Removes the default export, qualifies relative imports, and declares the exported function's return type.

src/cache-save/index.ts

run.tsUpdate cache save dependencies +5/-4

Update cache save dependencies

• Imports the named prune function with an explicit path and declares the exported function's return type.

src/cache-save/run.ts

flush-and-exit.tsDocument the intentional process exit +2/-1

Document the intentional process exit

• Declares a void return type and explains the lint exemption for exiting after output drains.

src/flush-and-exit.ts

index.tsSwitch action entry point to named imports +18/-16

Switch action entry point to named imports

• Updates imports for named exports and explicit relative extensions. Documents why runtime installation awaits each request in order.

src/index.ts

index.tsNormalize input module imports and export +12/-12

Normalize input module imports and export

• Uses node-prefixed and extension-qualified imports, removes the default export, and applies lint formatting.

src/inputs/index.ts

download.tsNormalize downloader imports and sequential operations +8/-5

Normalize downloader imports and sequential operations

• Uses node-prefixed imports and documents why alias file operations remain sequential.

src/install-pnpm/download.ts

index.tsUse named pnpm installer exports +4/-5

Use named pnpm installer exports

• Removes the default export and qualifies relative imports.

src/install-pnpm/index.ts

locked-version.tsNormalize locked-version module imports +7/-6

Normalize locked-version module imports

• Prefixes Node builtins and applies function declaration formatting.

src/install-pnpm/locked-version.ts

project.tsNormalize workspace project imports +7/-6

Normalize workspace project imports

• Prefixes Node builtins and applies lint formatting to function declarations and arguments.

src/install-pnpm/project.ts

registry.tsFormat registry resolver declaration +1/-1

Format registry resolver declaration

• Applies the shared rule for spacing before function parameters.

src/install-pnpm/registry.ts

run.tsNormalize installer imports and export +19/-17

Normalize installer imports and export

• Uses node-prefixed and extension-qualified imports, removes the default export, and applies lint formatting.

src/install-pnpm/run.ts

index.tsNormalize runtime installer syntax +31/-31

Normalize runtime installer syntax

• Updates imports, removes the default export, and declares exported return types. Renames a single-letter loop index and applies lint formatting.

src/install-runtime/index.ts

index.tsNormalize verification cache module syntax +24/-22

Normalize verification cache module syntax

• Uses node-prefixed and extension-qualified imports and applies function and switch-case formatting.

src/lockfile-verification-cache/index.ts

index.tsUse a named outputs export +4/-5

Use a named outputs export

• Removes the default export, qualifies relative imports, and declares a void return type.

src/outputs/index.ts

index.tsUse a named pnpm install export +10/-10

Use a named pnpm install export

• Removes the default export, updates Node and relative imports, and declares a void return type.

src/pnpm-install/index.ts

lockfile.tsNormalize lockfile helper imports +8/-8

Normalize lockfile helper imports

• Prefixes Node builtins and applies function and argument formatting.

src/pnpm-install/lockfile.ts

index.tsUse a named store-prune export +4/-5

Use a named store-prune export

• Removes the default export, qualifies the input import, and declares a Promise<void> return type.

src/pnpm-store-prune/index.ts

index.tsNormalize fingerprint imports and batch loop +14/-13

Normalize fingerprint imports and batch loop

• Prefixes Node builtins, renames a batch index, and documents the sequential awaits that bound memory use.

src/store-fingerprint/index.ts

index.tsRemove the Windows path default export +1/-3

Remove the Windows path default export

• Keeps the named path-normalization function and removes its default export.

src/windows-path/index.ts

Tests (14) +162 / -131
keys.test.mjsFormat cache key tests +3/-2

Format cache key tests

• Applies lint-required import spacing and argument formatting without changing assertions.

src/cache-restore/keys.test.mjs

run.test.mjsAlign cache test stubs with new imports +25/-16

Align cache test stubs with new imports

• Updates mocked module specifiers and named exports to match production imports. Formats fixtures, names the test context, and documents intentionally sequential awaits.

src/cache-restore/run.test.mjs

flush-and-exit.test.mjsRename flush test contexts +9/-8

Rename flush test contexts

• Uses descriptive test-context parameters and adjusts import and function formatting.

src/flush-and-exit.test.mjs

locked-version.test.mjsFormat locked-version tests +16/-9

Format locked-version tests

• Renames test contexts, sorts imports, and expands mock cleanup callbacks to satisfy lint rules.

src/install-pnpm/locked-version.test.mjs

project.test.mjsFormat project fixture helpers +3/-2

Format project fixture helpers

• Applies lint-required import spacing and function declaration formatting.

src/install-pnpm/project.test.mjs

registry.test.mjsFormat registry validation tests +5/-4

Format registry validation tests

• Renames the test context and adjusts imports and assertion formatting.

src/install-pnpm/registry.test.mjs

run.test.mjsMatch installer fixture specifiers to imports +10/-8

Match installer fixture specifiers to imports

• Updates the esbuild fixture to intercept extension-qualified and node-prefixed imports. Renames test contexts and documents a sequential manifest test.

src/install-pnpm/run.test.mjs

installed-versions.test.mjsRename runtime-version test contexts +21/-20

Rename runtime-version test contexts

• Uses descriptive test-context parameters and applies lint formatting to helper functions and calls.

src/install-runtime/installed-versions.test.mjs

node-version-file.test.mjsFormat Node version file tests +23/-22

Format Node version file tests

• Renames test-context parameters and applies import, argument, and helper formatting.

src/install-runtime/node-version-file.test.mjs

runtime-requests.test.mjsFormat runtime request tests +4/-3

Format runtime request tests

• Renames the test context and adjusts import and function-call formatting.

src/install-runtime/runtime-requests.test.mjs

index.test.mjsFormat verification cache tests +23/-20

Format verification cache tests

• Renames test contexts and helper parameters, and expands a fixture callback under lint rules.

src/lockfile-verification-cache/index.test.mjs

pnpm-commands.test.mjsFormat pnpm command tests +7/-6

Format pnpm command tests

• Renames test contexts and applies lint formatting to imports, fixtures, and bundled-module calls.

src/pnpm-commands.test.mjs

lockfile.test.mjsFormat lockfile tests +5/-4

Format lockfile tests

• Applies lint-required import spacing, function formatting, and argument formatting.

src/pnpm-install/lockfile.test.mjs

index.test.mjsFormat store fingerprint tests +8/-7

Format store fingerprint tests

• Renames a bucket loop variable and the test context, and applies import and function formatting.

src/store-fingerprint/index.test.mjs

Other (6) +1595 / -4
pr-check.yamlAdd a PR lint job +14/-0

Add a PR lint job

• Adds a job that installs dependencies and runs the new lint script for pull requests.

.github/workflows/pr-check.yaml

eslint.config.mjsConfigure shared pnpm lint rules +55/-0

Configure shared pnpm lint rules

• Combines pnpm and regexp rules, adapts applicable rules for MJS tests, and defines targeted exceptions. Temporarily exempts six existing files from size-and-shape limits.

eslint.config.mjs

package.jsonAdd lint command and compatible tooling +8/-1

Add lint command and compatible tooling

• Adds the ESLint script and dependencies. Aliases TypeScript 6 for tooling that needs its compiler API and TypeScript 7 for the native compiler.

package.json

pnpm-lock.yamlLock the lint and TypeScript toolchains +1509/-3

Lock the lint and TypeScript toolchains

• Records the new ESLint dependency tree and the TypeScript 6 compatibility and TypeScript 7 compiler packages.

pnpm-lock.yaml

pnpm-workspace.yamlDisallow the optional resolver build +3/-0

Disallow the optional resolver build

• Marks unrs-resolver's install script as disallowed because its optional native binding supplies the resolver.

pnpm-workspace.yaml

tsconfig.lint.jsonDefine the type-aware lint project +6/-0

Define the type-aware lint project

• Extends the main TypeScript settings and includes source TypeScript files for type-aware ESLint rules.

tsconfig.lint.json

Instead of exempting them from the lint rules:

- packageManagerManifest: finding the workspace root, checking
  membership against its `packages` patterns, and picking the root
  manifest are functions of their own.
- readEnvDocument: reading is a lazy generator of decoded chunks, and
  scanning for the separator is separate from it.
- runSelfInstaller: choosing the version spec is its own step.
- resolveRuntimeRequests: an explicit `runtime` resolves in its own
  function.
- readNodeVersionFile: reading one candidate and finding the workspace
  are separate; normalizeNodeVersion hands `lts/` selectors to a helper.
- runPnpmInstall: building the arguments, checking for a required
  lockfile, and reporting the result are separate.

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

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@zkochan
zkochan merged commit 7b46571 into main Oct 24, 2026
51 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