Code Monkey home page Code Monkey logo

tslint-config-leapfrog's Introduction

tslint-config-leapfrog

npm version downloads

โš ๏ธ TSLint is deprecated. We don't recommend using this configuration anymore, use eslint-config-leapfrog instead.

Set of TSLint rules for TypeScript projects at Leapfrog.

tslint-config-leapfrog adds rules from tslint-consistent-codestyle and tslint-react.

Requires

  • TypeScript >= 2.5.0
  • TSLint >= 5.8.0

Usage

Add tslint-config-leapfrog as a dev dependency.

yarn add tslint-config-leapfrog --dev

Include tslint-config-leapfrog in your tslint.json file.

{
  "extends": [
    "tslint-config-leapfrog"
  ]
}

For projects using React, include tslint-config-leapfrog/react which contains TSLint rules specific to React.

{
  "extends": [
    "tslint-config-leapfrog/react"
  ]
}

License

MIT

tslint-config-leapfrog's People

Contributors

dependabot[bot] avatar mesaugat avatar prabhtz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

prabhtz

tslint-config-leapfrog's Issues

Allow return await statements

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:

"no-return-await": true,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.