-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please 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-estreeIssues related to @typescript-eslint/typescript-estree
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
.eslintrc.yml
root: true
parser: '@typescript-eslint/parser'
parserOptions:
project: tsconfig.json
allowAutomaticSingleRunInference: truetsconfig.json
{
"files": ["index.ts"]
}index.ts
// nothingpnpm install
DEBUG=typescript-eslint:* pnpm eslint index.ts
# or
DEBUG=typescript-eslint:* ./node_modules/.bin/eslint index.tsExpected 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 ast for /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 of time for project: /path/to/typescript-eslint-single-run-pnpm/tsconfig.json +2ms
typescript-eslint:parser:parser Resolved libs from program: [ 'lib' ] +0msActual 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 program for /path/to/typescript-eslint-single-run-pnpm/tsconfig.json. +0ms
typescript-eslint:typescript-estree:createWatchProgram Found program for file. /path/to/typescript-eslint-single-run-pnpm/index.ts +573ms
typescript-eslint:parser:parser Resolved libs from program: [ 'lib' ] +0msAdditional 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) in node_modules/.bin/eslint:
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -z "$NODE_PATH" ]; then
export NODE_PATH="/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/[email protected]/node_modules/eslint/bin/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/[email protected]/node_modules/eslint/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/[email protected]/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"
else
export NODE_PATH="$NODE_PATH:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/[email protected]/node_modules/eslint/bin/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/[email protected]/node_modules/eslint/node_modules:/path/to/typescript-eslint-single-run-pnpm/node_modules/.pnpm/[email protected]/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"
fi
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../eslint/bin/eslint.js" "$@"
else
exec node "$basedir/../eslint/bin/eslint.js" "$@"
fiThis means that process.argv[1] ends with node_modules/eslint/bin/eslint.js instead of node_modules/.bin/eslint.
I know that I can just use TSESTREE_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
| package | version |
|---|---|
@typescript-eslint/typescript-estree |
4.29.3 |
TypeScript |
4.3.5 |
node |
16.8.0 |
rdsedmundo, kmin-jeong, SukkaW and JoshuaKGoldberg
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please 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-estreeIssues related to @typescript-eslint/typescript-estree