Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: allowAutomaticSingleRunInference not working in pnpm repository #8593

Closed
4 tasks done
xqxian opened this issue Mar 3, 2024 · 2 comments
Closed
4 tasks done

Bug: allowAutomaticSingleRunInference not working in pnpm repository #8593

xqxian opened this issue Mar 3, 2024 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@xqxian
Copy link
Contributor

xqxian commented Mar 3, 2024

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

typescript-estree

Playground Link

No response

Repro Code

# Run eslint from command line in a pnpm repository
eslint any-file.ts --ext .ts

ESLint Config

module.exports = {
  parser: '@typescript-eslint/parser',
  parserOptions: {
    allowAutomaticSingleRunInference: true,
  },
};

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

typescript-eslint detects single run mode successfully

Actual Result

typescript-eslint detects single run mode failed

Additional Info

I have found that the cause of the problem lies in the file path detection for enabling single run mode(source).

When running eslint from the command line in a pnpm repository, the eslint bin file path will end with node_modules/eslint/bin/eslint.js so the single run mode detection will fail:

"Screenshot of running breakpoint"

I am currently working on a pnpm monorepo that contains more than 40 TypeScript projects. I would like to use allowAutomaticSingleRunInference to enhance performance and would be happy to submit a PR to fix it. I know that by setting the environment variable TSESTREE_SINGLE_RUN=true, I can force typescript-eslint to run in single run mode. However, relying solely on this approach may not be optimal as it can be easy to forget to set the environment variable when running eslint manually from the command line.

Versions

package version
@typescript-eslint/eslint-plugin 7.1.0
@typescript-eslint/parser 7.1.0
@typescript-eslint/rule-tester 7.1.0
@typescript-eslint/scope-manager 7.1.0
@typescript-eslint/typescript-estree 7.1.0
@typescript-eslint/type-utils 7.1.0
@typescript-eslint/utils 7.1.0
TypeScript 4.9.5
ESLint 8.57.0
node 18.18.1
pnpm 6.35.1
@xqxian xqxian added bug Something isn't working triage Waiting for maintainers to take a look labels Mar 3, 2024
Copy link

github-actions bot commented Mar 3, 2024

Uh oh! @xqxian, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

@bradzacher
Copy link
Member

Duplicate of #3811

Please use the search

@bradzacher bradzacher closed this as not planned Won't fix, can't repro, duplicate, stale Mar 3, 2024
@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels Mar 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants