Tslint: 通过 max-line-length 从导入中排除长度

创建于 2016-12-14  ·  3评论  ·  资料来源: palantir/tslint

你好,

问题/可能的功能..?


gulp-tslint: 6.1.1 通过 - Visual Studio

规则:

https://palantir.github.io/tslint/rules/max-line-length/

tslint.json配置:

"max-line-length": [
  true,
  150
],

是否有任何现有方法可以从该规则中排除进口?

import { item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18, item19, item20 } from "@angular/router";

非常感谢。

Accepting PRs Enhancement

最有用的评论

之前在 #1123 中已请求过此操作。 我不介意有一个选项来禁用导入语句的规则,但我们不会在内置配置中启用。

所有3条评论

@Ne-Ne 这是这条规则的确切情况。
在这种情况下,最好将导入写入一行(更容易合并/审查列表中的更改),或者您可以将其加载为

import * as routes from "@angular/router";

然后在需要时使用必需的项目作为routes.item2

或者您可以仅使用规则标志为单行禁用此规则。

之前在 #1123 中已请求过此操作。 我不介意有一个选项来禁用导入语句的规则,但我们不会在内置配置中启用。

关闭支持#1123

此页面是否有帮助?
0 / 5 - 0 等级