tslint-microsoft-contrib

在一些微软项目中使用的一组 TSLint 规则。(A set of TSLint rules used on some Microsoft projects.)

  • 所有者: microsoft/tslint-microsoft-contrib
  • 平台: BSD, Cross-platform, Linux, Mac, Web browsers, Windows
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

tslint-microsoft-contrib

在一些微软项目中使用的一组 TSLint 规则。

请参阅我们的发行说明以查找最新的新规则。

安装

npm install tslint-microsoft-contrib --save-dev

TSLint和相应的tslint-microsoft-contrib版本

TSLint version tslint-microsoft-contrib version
>= 5.x 5.x and 6.x (supporting TypeScript 2.3.x, >=2.4, 3.x)
>= 4.x 4.x (supporting TypeScript 2.1.x)
>= 3.2.x 2.x
3.1.x unsupported
3.0.x unsupported
2.x 1.x

配置

在“rulesDirectory”配置下添加“node_modules/tslint-microsoft-contrib”以通知TSLint它应该在此包下查找tslint.json中的其他规则:

{
    "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
    "rules": {
        // ...
    }
}
我应该打开哪个规则?

当然有很多选择! 首先,您可以通过在tslint.json中的“extends”下添加“tslint-microsoft-contrib”来启用我们推荐的默认值(recommended_ruleset.js):

{
    "extends": ["tslint-microsoft-contrib"],
    "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
    "rules": {
        // ...
    }
} 

然后,您可以禁用您认为有用的规则。

请注意,某些默认规则需要--project TSLint选项。

另请注意,向推荐的规则集添加规则被视为向后兼容。 如果依赖于依赖项中的版本范围,那么您可能会发现添加到产品中的新规则会导致违规并导致构建失败。 我们建议您在package.json中指定lint库的确切版本,包括tslint-microsoft-contrib。

主要指標

概覽
名稱與所有者microsoft/tslint-microsoft-contrib
主編程語言TypeScript
編程語言JavaScript (語言數: 2)
平台BSD, Cross-platform, Linux, Mac, Web browsers, Windows
許可證MIT License
所有者活动
創建於2015-08-20 12:44:29
推送於2020-12-10 08:13:40
最后一次提交2020-12-10 09:13:39
發布數73
最新版本名稱6.2.0 (發布於 )
第一版名稱npm-0.0.1 (發布於 )
用户参与
星數702
關注者數49
派生數200
提交數879
已啟用問題?
問題數511
打開的問題數0
拉請求數270
打開的拉請求數0
關閉的拉請求數113
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

tslint-microsoft-contrib

npm version
Downloads
TravisCI Build Status
Azure Pipelines Build Status
Join the chat at https://gitter.im/Microsoft/tslint-microsoft-contrib
code style: prettier

A set of TSLint rules used on some Microsoft projects.

Notice

This project is in read-only and archive mode.

Installation

npm install tslint-microsoft-contrib --save-dev

TSLint and corresponding tslint-microsoft-contrib version

TSLint version tslint-microsoft-contrib version
>= 5.x 5.x and 6.x (supporting TypeScript 2.3.x, >=2.4, 3.x)
>= 4.x 4.x (supporting TypeScript 2.1.x)
>= 3.2.x 2.x
3.1.x unsupported
3.0.x unsupported
2.x 1.x

Configuration

Add "node_modules/tslint-microsoft-contrib" under your "rulesDirectory" configuration to inform TSLint it should look under this package for additional rules in your tslint.json:

{
    "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
    "rules": {
        // ...
    }
}

Which Rules Should I Turn On?

There certainly are a lot of options!

If you extend from one of the following configurations, rulesDirectory will have node_modules/tslint-microsoft-contrib included for you.

Please note, some of the default ruleset rules require the --project TSLint option.

To start, you can enable our stable "recommended" defaults that come with tslint-microsoft-contrib (recommended.json) by adding "tslint-microsoft-contrib/recommended" under "extends" in your tslint.json:

{
    "extends": ["tslint-microsoft-contrib/recommended"]
    // ...
}

These rules will not be added to in minor or patch releases, but will be in major releases.

Latest

To run with the latest and greatest rules (latest.json), extend from tslint-microsoft-contrib/latest:

{
    "extends": ["tslint-microsoft-contrib/latest"]
    // ...
}

These rules will not be added to in patch releases, but will be in minor releases.

Legacy

The old "recommended" ruleset that ships by extending tslint-microsoft-contrib itself contains a list of rules that includes core TSLint rules.

To start, you can enable our recommended defaults (recommended.json) by adding just "tslint-microsoft-contrib" under "extends" in your tslint.json:

{
    "extends": ["tslint-microsoft-contrib"]
    // ...
}

This ruleset is considered legacy; it is generally preferable to extend from the 'recommended' or 'latest' rulesets.
We recommend you instead explicitly include tslint:recommended, tslint:latest, or tslint:all in your tslint.json rather than enable core rules through this configuration.

In the next major version of TSLint, this will instead be an alias for "tslint-microsoft-contrib/recommended".

Overriding Configurations

You can disable rules you don't find useful.

If you rely on version ranges in your dependencies then you may find that new rules being added to the product create violations and fail your build.
We recommend you specify exact versions of lint libraries, including tslint-microsoft-contrib, in your package.json.

Supported Rules

Development

See CONTRIBUTING.md.

Release notes

Check GitHub Releases for individual release notes or CHANGELOG.md for full project changelog.