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

lint: add "promise-function-async" rule #28109

Open
tjconcept opened this issue Feb 13, 2025 · 5 comments
Open

lint: add "promise-function-async" rule #28109

tjconcept opened this issue Feb 13, 2025 · 5 comments
Labels
lint Issues related to deno lint

Comments

@tjconcept
Copy link

The rule promise-function-async seems like something I would want to enable.

@marvinhagemeister
Copy link
Contributor

This rule requires type information which the current linter has no access to. We've recently landed support for JS plugins for our linter and aren't too far off from wiring up tsc into that. Once that's done it should be doable to run typescript-eslint rules with Deno's linter.

@tjconcept
Copy link
Author

Aha. That sounds slow and expensive? Why wouldn't it get the type information from its own AST?

@marvinhagemeister
Copy link
Contributor

To get type information you need to invoke tsc and look at more than the current file. The AST alone is not enough to get the type, except for very few obvious cases.

@tjconcept
Copy link
Author

I see. I'm just curious.

Would this be possible to do in a performant way? I assume my IDE (Zed) is communicating with a long-running instance of the Deno LSP, but is it then rerunning the entire process of parsing the code, building an AST, passing to tsc, which builds its own AST, etc. on "every key stroke"?

@marvinhagemeister
Copy link
Contributor

There is a bunch of code in place to avoid doing unnecessary work, although at some point you'll need to reparse the current file. I'm not too familiar with the LSP side of things, but I don't think it happens on every key stroke.

@marvinhagemeister marvinhagemeister added the lint Issues related to deno lint label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lint Issues related to deno lint
Projects
None yet
Development

No branches or pull requests

2 participants