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.