8000 Specify custom typescript with ParserOptions · Issue #2660 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content

Specify custom typescript with ParserOptions #2660

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

Closed
3 tasks done
yoyo930021 opened this issue Oct 10, 2020 · 2 comments
Closed
3 tasks done

Specify custom typescript with ParserOptions #2660

yoyo930021 opened this issue Oct 10, 2020 · 2 comments
Labels
package: parser Issues related to @typescript-eslint/parser wontfix This will not be worked on

Comments

@yoyo930021
Copy link
Contributor
yoyo930021 commented Oct 10, 2020
  • 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.

We need to set special typescript when sometimes.
Like #2127 , yarn PnP support, monorepo.

We can add a option like:

module.exports = {
  root: true,
  parserOptions: {
    parser: '@typescript-eslint/parser',
    typescript: require('typescript'), // or `instance`
    project: './tsconfig.json',
    sourceType: 'module'
  },
  plugins: [
    '@typescript-eslint',
  ]
};

Many packages have same design.
https://github.com/TypeStrong/ts-loader#instance
https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#typescript-options

I'm willing to implement this feature if the maintainer has no problem with it.

@yoyo930021 yoyo930021 added package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look labels Oct 10, 2020
@bradzacher
Copy link
Member
bradzacher commented Oct 10, 2020

This won't work the way you think it will.

Plugins use tools, enums and utils from typescript (and libraries like our utils package or tsutils).

All of these pieces just import typescript directly - they don't consume typescript from our parser services.

If there's any discrepancies between versions etc, it will cause undefined behaviour in the lint rules.

You would be much better off using something like an npm alias to use a completely different typescript package so that every piece of the lint run uses exactly the same package.

@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for team members to take a look labels Oct 10, 2020
@yoyo930021
Copy link
Contributor Author

You're right.
It seems difficult to use different TypeScript versions in monorepo.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
@bradzacher bradzacher added wontfix This will not be worked on and removed awaiting response Issues waiting for a reply from the OP or another party labels Jan 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: parser Issues related to @typescript-eslint/parser wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants
0