Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support pnpm for single run detection #3811

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestgood first issueGood for newcomerslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: typescript-estreeIssues related to @typescript-eslint/typescript-estree
@cherryblossom000

Description

@cherryblossom000
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I haveread the FAQ and my problem is not listed.

Repro

.eslintrc.yml

root:trueparser:'@typescript-eslint/parser'parserOptions:project:tsconfig.jsonallowAutomaticSingleRunInference:true

tsconfig.json

{"files": ["index.ts"]}

index.ts

// nothing
pnpm installDEBUG=typescript-eslint:* pnpm eslint index.ts# orDEBUG=typescript-eslint:* ./node_modules/.bin/eslint index.ts

https://github.com/cherryblossom000/typescript-eslint-single-run-pnpm

Expected Result

typescript-estree should detect that this is a single run of ESLint.

$ TSESTREE_SINGLE_RUN=true DEBUG=typescript-eslint:* pnpm eslint index.ts  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: Set(1) {'/path/to/typescript-eslint-single-run-pnpm/tsconfig.json'} +0ms  typescript-eslint:typescript-estree:useProvidedProgram Retrieving astfor /path/to/typescript-eslint-single-run-pnpm/index.ts from provided program instance(s) +0ms  typescript-eslint:typescript-estree:parser Detected single-run/CLI usage, creating Program once ahead oftimefor project: /path/to/typescript-eslint-single-run-pnpm/tsconfig.json +2ms  typescript-eslint:parser:parser Resolved libs from program: ['lib' ] +0ms

Actual Result

typescript-estree did not detect that this was a single run.

$ DEBUG=typescript-eslint:* pnpm eslint index.ts  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: Set(1) {'/path/to/typescript-eslint-single-run-pnpm/tsconfig.json'} +0ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /path/to/typescript-eslint-single-run-pnpm/index.ts +0ms  typescript-eslint:typescript-estree:createWatchProgram File did not belong to any existing programs, moving to create/update. /path/to/typescript-eslint-single-run-pnpm/index.ts +0ms  typescript-eslint:typescript-estree:createWatchProgram Creating watch programfor /path/to/typescript-eslint-single-run-pnpm/tsconfig.json. +0ms  typescript-eslint:typescript-estree:createWatchProgram Found programfor file. /path/to/typescript-eslint-single-run-pnpm/index.ts +573ms  typescript-eslint:parser:parser Resolved libs from program: ['lib' ] +0ms

Additional Info

Instead of copying the Node.js CLI script,pnpm creates a shell script that invokes the direct path to the script (e.g.node node_modules/eslint/bin/eslint.js) innode_modules/.bin/eslint:

#!/bin/shbasedir=$(dirname"$(echo"$0"| sed -e's,\\,/,g')")case`uname`in*CYGWIN*) basedir=`cygpath -w"$basedir"`;;esacif [-z"$NODE_PATH" ];thenexport NODE_PATH="/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/eslint@7.32.0/node_modules/eslint/bin/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/eslint@7.32.0/node_modules/eslint/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/eslint@7.32.0/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules:/path/to/node_modules:/path/node_modules:/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/eslint/bin/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/eslint/node_modules"elseexport NODE_PATH="$NODE_PATH:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/eslint@7.32.0/node_modules/eslint/bin/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/eslint@7.32.0/node_modules/eslint/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/eslint@7.32.0/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules:/path/to/node_modules:/path/node_modules:/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/eslint/bin/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/eslint/node_modules"fiif [-x"$basedir/node" ];thenexec"$basedir/node""$basedir/../eslint/bin/eslint.js""$@"elseexec node"$basedir/../eslint/bin/eslint.js""$@"fi

This means thatprocess.argv[1] ends withnode_modules/eslint/bin/eslint.js instead ofnode_modules/.bin/eslint.

I know that I can just useTSESTREE_SINGLE_RUN=true, that ESLint could change the path to the bin file at any time, and that pnpm isn't as popular as npm and yarn, so I understand if this isn't actionable.

Versions

packageversion
@typescript-eslint/typescript-estree4.29.3
TypeScript4.3.5
node16.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestgood first issueGood for newcomerslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp