leapfrogtechnology / tslint-config-leapfrog Goto Github PK
View Code? Open in Web Editor NEWSet of TSLint rules for TypeScript projects at Leapfrog.
Home Page: https://yarn.pm/tslint-config-leapfrog
License: MIT License
Set of TSLint rules for TypeScript projects at Leapfrog.
Home Page: https://yarn.pm/tslint-config-leapfrog
License: MIT License
TSLint is going to be deprecated in 2019. Read here ๐ palantir/tslint#4534
We need to migrate to typescript-eslint soon.
Allowing return await [expression]
is not an anti-pattern anymore.
TL;DR: Always do return await when returning a promise to benefit full error stacktrace. If a function returns a promise, that function must be declared as async function and explicitly await the promise before returning it
Otherwise: The function that returns a promise without awaiting won't appear in the stacktrace. Such missing frames would probably complicate the understanding of the flow that leads to the error, especially if the cause of the abnormal behavior is inside of the missing function
Snipped explanation:
There is a number of excellent articles explained why return await should never be used outside of try block and even an ESLint rule that disallows it. The reason for that is the fact that since async/await become available with transpilers in Node.js 0.10 (and got native support in Node.js 7.6) and until "zero-cost async stacktraces" was introduced in Node.js 10 and unflagged in Node.js 12, return await was absolutely equivalent to return for any code outside of try block. It may still be the same for some other ES engines. This is why resolving promises before returning them is the best practice for Node.js and not for the EcmaScript in general
For more info: Click here
This line in particular seems to be enabling the rule:
tslint-config-leapfrog/tslint.json
Line 53 in 17c4728
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.