-
-
Notifications
You must be signed in to change notification settings - Fork 446
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Linter experiment: TypeScript no-floating-promises via inter-process communication #2218
Comments
SummaryI had a look through There might be another option though: implement a TSServer like utility to give us access to type checker the way Communication with TSServerCommunication with The rest of documentation is in the form of comments in code. All the available commands are listed in protocol.ts and usually have a simple description atteched to the command arguments object. The corresponding implementation can be found in the session.ts. But looking through the code I did not see a way to access type checker API we need for lint rules. Type checker APIThe API used by Alternative solutionLook into typescript-estree and build something similar in JS, importing typescript directly and exposing an API to load the project, open/close files and access the type checker. This seems doable, but calling methods over IPC might have too much overhead to make it sufficiently fast. We might want to consider using JS code for anything to do with type checker. For example rules could have an associated JS file, that define functions that the rule could call through the IPC interface. The JS function would accept Typescript AST node as input, and perform all the necessary type checking logic on the JS side. So with the |
I have implemented proof-of-concept in a separate repo: https://github.com/valeneiko/typecheck-server It is not a full implementation of the lint rule, just the type checker related logic from it. We can pass an AST node from Rust side to JS side, and access type information about it (on JS side), but that should be enough to implement the rule. Let me know your thoughts! |
@camc314 Are you interested in implementing the rule on our side and integrate it with https://github.com/valeneiko/typecheck-server? |
I'd love to, but my time is stretched very thin currently 😞 . |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
This is a call for help and community effort.
The goal is to get a working draft for typescript-eslint's no-floating-promises or conclude that this is not doable.
To get things working, we are going to neglect all performance impacts.
The idea is that we spawn a node process with the TypeScript server and communicate with it via http or rpc or whatever means necessary. It doesn't really matter how we spawn the server, within Rust or as a standalone server, as long as we can communicate with it.
The core logic from typescript-eslint is here: https://github.com/typescript-eslint/typescript-eslint/blob/a41ad155b5fee9177651439adb1c5131e7e6254f/packages/eslint-plugin/src/rules/no-floating-promises.ts#L221
The text was updated successfully, but these errors were encountered: