npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dscheerens/tslint-presets

v9.0.0

Published

Package containing recommended tslint configuration presets

Downloads

39

Readme

NPM Version

TSLint presets

This NPM package contains a number of recommended TSLint presets.

Installation

Install the package using the following command:

npm install --save-dev @dscheerens/tslint-presets

This will automatically install tslint as a dependency for your project.

For Angular projects it is recommended to use an Angular specific preset. This preset makes use of Codelyzer, which also need to be installed as a dependency:

npm install --save-dev codelyzer

Usage

Create a new tslint.json in the root of your project with the following contents:

{
    "extends": "@dscheerens/tslint-presets/tslint.recommended.json",
    "rules": {

    }
}

Use the extends property to specify which preset you would like to use for your project. The different presets offered by this package are described in the next section.

You can override the tslint rules from the chosen preset by adding the custom configuration for those rules to the rules property.

Available presets

This package offers the following TSLint presets:

| Preset | Description | |----------------------------------------------------|----------------------------------------------------------------| | tslint.recommended.json | This is the default preset to use for Typescript projects. | | tslint.recommended.no-type-checking.json | Same as previous without rules that require type checking. | | tslint.recommended.angular.json | Recommended rules + Codelyzer rules. Use for Angular projects. | | tslint.recommended.angular.no-type-checking.json | Same as previous without rules that require type checking. |

Type checking

Some rules require type checking. To support those rules run TSLint with the --project flag. For more information see the type checking documentation for TSLint.

In order for your IDE to support type checking with TSLint you may want to make use of the tslint-language-service package.

If you make use of the tslint-language-service and use Visual Studio Code as IDE, disable the TSLint extension to avoid that files are linted twice. You can disable the extension for the workshop/project only, so it won't be disabled for other projects which might not use the tslint-language-service.

Best practices for TSLint

Ideally you should not override the recommended rules to make them less strict. If you have some case in which a TSLint rule doesn't make sense it is usually best to disable that rule for the next line by adding a TSLint instruction comment, for example:

// tslint:disable-next-line:rule-name

That way the rule is still enforced in other places. If you are in the process of integrating the recommended TSLint rules in your project you might run into a lot of violations for the same rule. In that case it is best to disable that rule for your project by adding it to the rules property of your tslint.json file, for example:

{
    "extends": "@dscheerens/tslint-presets/tslint.recommended.angular.json",
    "rules": {
        "prefer-readonly": false,
        "strict-indent-size": [true, 2]
    }
}

Afterwards you can gradually start working on fixing the violations, until eventually you can enable the rule again by removing the override from the tslint.json file.