Comments (15)
Maybe deno fmt should just remove multiple awaits.
from deno_lint.
Sounds reasonable, PRs are welcome
from deno_lint.
Has anyone ever written this kind of code though? Is a rule worth it considering the extra time necessary to check for this condition? Perhaps there is precedence in other linters?
from deno_lint.
It seems people write this kind of code: https://github.com/search?type=code&q=%22await+await+%22+language%3AJavaScript&l=JavaScript (maybe when coming from other languages like c# where this is necessary)
from deno_lint.
I have written this code by accident ... you can easily end up with await await
when copy'n'pasting code.
from deno_lint.
As I explained in the issue description await await
can result in different behavior than just await
, so I think this change would be too dangerous for deno fmt
, which I'd expect to never change the semantics of code.
from deno_lint.
I'm surprised the tsc warning isn't shown in this case
'await' has no effect on the type of this expression. deno-ts(80007)
While the number of
await
keywords can affect which promise job is executed first
Does that really happen when await
ing a non-promise?
from deno_lint.
I'm surprised the tsc warning isn't shown in this case
Oh, ... yeah me too. In case we get that warning to work then this lint is probably redundant.
Does that really happen when awaiting a non-promise?
Yes, according to the ECMAScript standard it even must happen.
from deno_lint.
It does affect it, but I wouldn't consider it too dangerous. That said, considering it does change execution that's reasonable to not do it for formatting.
I'm surprised the tsc warning isn't shown in this case
Considering this is already handled by tsc, I think we should not add this to deno_lint. I'm going to close this issue.
from deno_lint.
I guess we should open a new issue at denoland/deno
about that tsc warning not being reported for await await fetch('/test');
?
from deno_lint.
I guess we should open a new issue at denoland/deno about that tsc warning not being reported for await await fetch('/test');?
It is reported as a warning in the editor.
from deno_lint.
But not by deno check
?
from deno_lint.
Ah, seems to work inconsistently:
from deno_lint.
Oh yeah. Looks like typescript is only reporting this as a suggestion diagnostic, which we don't surface except in the editor. Perhaps it being reported via deno lint would still be good. I'm going to reopen.
from deno_lint.
Slightly getting off-topic but would it make sense to add a deno check
flag to also report suggestion diagnostics? Although it seems like the tsc
CLI doesn't have such a flag.
from deno_lint.
Related Issues (20)
- Rule suggestion: Consistent Type Definitions
- Rule suggestion: remove `no-control-regex` from defaults
- Feature request: smarter `no-extra-non-null-assertion` HOT 3
- Hundreads of panics when testing broken files HOT 6
- `no-fallthrough` warns when infinite loop with no break precludes fallthrough HOT 1
- `/^\s*?\n/v` produces incorrect lints
- suggestion: remove `object` from `ban-types`
- Rule suggestion: `switch-exhaustiveness-check` HOT 2
- Add `no-window-global` lint rule
- Remove ./tools/format.js and ./tools/lint.js HOT 1
- Rule against redundant closures HOT 2
- Disable `require-await` by default HOT 2
- warn about sync usage inside async function
- Rule suggestion: prefer-object-shorthand
- Rule suggestion: no-compare-to-new HOT 1
- fresh-server-event-handlers should now allow colocated (_islands) directory HOT 2
- Fallthrough is not allowed when adding comment above switch case HOT 2
- upgrade no-sync-fn-in-async-fn HOT 2
- `no-var`: report on the `var` keyword, not the entire var declaration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deno_lint.