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

[consistent-type-imports] support decorator metaData without specifying project #4638

Closed
xboy2012 opened this issue Mar 7, 2022 · 3 comments · Fixed by #4646
Closed

[consistent-type-imports] support decorator metaData without specifying project #4638

xboy2012 opened this issue Mar 7, 2022 · 3 comments · Fixed by #4646
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: parser Issues related to @typescript-eslint/parser

Comments

@xboy2012
Copy link
Contributor

xboy2012 commented Mar 7, 2022

For projects that use "emitDecoratorMetaData: true" in tsconfig.json

If we want to use consistent-type-imports, we have to specify project in parserOptions, in order to prevent the rule from reporting false positives.

Everything works OK as we configure as above. But we encounter performance issues. Linting time is too long.

As we specified project in parserOptions, then we uses type-aware linting(In other words, we need to compile source code by typescript).

However, is it really the best practice to do like this?

  • I only need the parser to understand emitDecoratorMetaData: true
  • I do not need the time-costing type-aware linting.

Is there a way to just tell consistent-type-imports to act as if emitDecoratorMetaData: true is set, without really compiling with typescript?

such as add an option to the rule

"@typescript-eslint/consistent-type-imports": ['error', { emitDecoratorMetaData: true }]
@xboy2012 xboy2012 added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Mar 7, 2022
@bradzacher
Copy link
Member

I do not need the time-costing type-aware linting

Have you checked out our list of type-aware lint rules? There are a lot of very valuable rules which can help catch many bugs!


This is a known weakness. As mentioned in #4608, we should add an option here.

@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue package: parser Issues related to @typescript-eslint/parser enhancement New feature or request and removed package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Mar 7, 2022
@xboy2012
Copy link
Contributor Author

xboy2012 commented Mar 8, 2022

I do not need the time-costing type-aware linting

Have you checked out our list of type-aware lint rules? There are a lot of very valuable rules which can help catch many bugs!

This is a known weakness. As mentioned in #4608, we should add an option here.

I know it. But just in this case, type-aware lint is not necessary. We can obviously tell the parser to act as if emitDecoratorMetaData: true, without having to specify project, which includes the unwanted type-aware lint.

@xboy2012
Copy link
Contributor Author

xboy2012 commented Mar 8, 2022

I think this is exactly what I want, as you said.

#4608 (comment)

@bradzacher bradzacher linked a pull request Mar 11, 2022 that will close this issue
3 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: parser Issues related to @typescript-eslint/parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants