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

unawaited_futures lint does not work on the following line of code #57711

Closed
nshahan opened this issue May 24, 2018 · 3 comments
Closed

unawaited_futures lint does not work on the following line of code #57711

nshahan opened this issue May 24, 2018 · 3 comments
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@nshahan
Copy link
Contributor

nshahan commented May 24, 2018

final cssOutput = sass.compileStringAsync(
        await buildStep.readAsString(inputId),
        importers: [new BuildImporter(buildStep)],
        style: _getValidOutputStyle());

You can see the signature of compileStringAsync() at the link below. It is async and not being awaited but the lint does not give any feedback about it.

https://github.com/sass/dart-sass/blob/8e1d80c4790a9a10afa3ecd0791f8611d5b53b6b/lib/sass.dart#L207

@pq
Copy link
Member

pq commented May 24, 2018

/cc @ochafik

@natebosch
Copy link
Member

Here's the full context:
https://github.com/dart-league/sass_builder/blob/ac821bca17c207c0333c032e563eae2bfd0b537f/lib/sass_builder.dart#L41-L49

This is hitting the case where assigning to a variable suppresses the lint. Usually that's an OK thing to suppress on because either that variable is unused or the later usage should statically warn you that you've got a Future<T> instead of a T... The problem comes in that this variable was used, just not in a way that is sane for a Future<T> but without any warning.

Maybe we should consider a lint like avoid_to_string_on_future which would have helped track this down?

@srawlins
Copy link
Member

I think that's a fair assessment. Looks like the rule is working as best as we intend it to.

@devoncarew devoncarew added analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants