-
-
Notifications
You must be signed in to change notification settings - Fork 545
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
📎 Implement nursery/noFloatingPromises - typescript-eslint/no-floating-promises #4956
Comments
Other important bullet points to add would be “inferred types” and “derived types”. The first refers to working with functions that don’t have an explicit return type annotation, and are contextual inference. After you support assigned functions and promises, you’re already partly there, but you also need to consider control flow within a function to determine the possible return values. Derived types are where the TypeScript type system gets really funky, and you need to support all the generics handling and other way to create types from types. There’s a lot of libraries that do stuff like that, and if you invoke methods on such types we’d also like to detect if they return a promise. Both can get quite complex, but I expect I may start work on those sooner rather than later. I think we can coordinate by adding subtasks to this issue. |
Hello, I’m planning to implement support for multi-file analysis in As far as I understand, My current approach is as follows:
Here’s a rough implementation of this idea: let import = imports.static_imports.get(specifier)?;
let resolved_path = import.resolved_path.ok()?;
let source_text = read_to_string(resolved_path).ok()?;
let root = parse(
source_text.as_str(),
JsFileSource::ts(),
JsParserOptions::default(),
);
// Traverse `root` to find the imported expression Does this seem like a valid approach? Or is there a better way to achieve this? |
@kaykdm Awesome! Good to hear progress is going well! As it happens, I'm just in the process of extending the dependency graph to become a little bit smarter. It's still very much work-in-progress, but for transparency I just pushed my WIP branch here: https://github.com/biomejs/biome/compare/main...arendjr:no-private-imports?expand=1 The idea is that it doesn't merely resolve the paths any more, but it should also be able to resolve to specific symbols within the target files. However, as I was working on this, I also realised that what I'm doing is slightly naive: With a single pass I can resolve to the Just yesterday, I created another issue to tackle that, although @ematipico made some good comments on Discord for why the suggestion I made in that issue might not be exactly what we want. In other words, it's still under consideration how exactly we wish to proceed. As you can probably guess at this point, reading the files pointed to by the dependency graph and parsing them, is not how we want to proceed. The main reason being that we would have to parse the same files over and over. And to add to all of that: Once the Biome 2.0 beta is out (which should happen quite soon now), I also want to shift my attention to work on proper type inference for Biome. That's going to be a major undertaking, but it is very much connected to all these pieces we're discussing here, and it will directly influence the future direction of the So I think the point you've reached is that you've hit the very forefront of what we can do with our multi-file analysis today :) But I've been following your progress with great interest, and things are moving very much in a direction we'd like to continue. Right now, these are the options I see:
Feel free to discuss here, or on Discord. Thanks for your efforts so far! |
Another update, I've created a PR based on the WIP branch I linked above: #5329 Once this is merged, it should allow you to continue some of the work on top of that without risking merge conflicts at least :) |
@arendjr
I'll look into this and see if it's possible to implement a basic export/import check for noFloatingPromises. |
Description
The rule will cover no-floating-promises
Some context here
Feature support / tasks checklist
The text was updated successfully, but these errors were encountered: