Tslint: 引号规则不允许选项和严重性。

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

错误报告

  • __TSLint 版本__:5.2.0
  • __打字稿版本__:2.3.1
  • __通过__运行TSLint:(选择一个)CLI / Node.js API / VSCode / grunt-tslint / Atom / Visual Studio / etc

正在整理 TypeScript 代码

import { BottomSheetKey, BottomSheetService } from "bottomSheet";
import { INavItem, NavHeight } from 'core/services/nav.service';
import { Configuration } from './app.configuration';

使用tslint.json配置:

{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended"
    ],
    "jsRules": {},
    "rules": {
        "quotemark": {
            "options": [ true, "single", "avoid-escape" ],
            "severity": "warning"
        }
    },
}

实际行为

quotemark规则被忽略。

预期行为

应该在"bottomSheet"处提供的代码段的第 1 行的quotemark规则中报告警告。

想法

这可能是一个更大的规则问题,但我只用quotemark观察到它。

Question

最有用的评论

如果您使用带有严重性和选项的新配置格式,您不希望
第一个选项是true 。 如果将其从数组中删除,则规则
应该按预期工作。

上午 12.05.2017 18:07 schrieb“Jacob Robertson”通知@github.com:

错误报告

  • TSLint 版本:5.2.0
  • 打字稿版本:2.3.1
  • 通过以下方式
    grunt-tslint / Atom / Visual Studio / 等

正在整理 TypeScript 代码

import { BottomSheetKey, BottomSheetService } from "bottomSheet"; import { INavItem, NavHeight } from 'core/services/nav.service'; import { Configuration } from './app.configuration';

使用 tslint.json 配置:

{
"defaultSeverity": "错误",
“扩展”:[
tslint:推荐
],
"jsRules": {},
“规则”:{
“引号”:{
"options": [ true, "single", "avoid-escape" ],
“严重性”:“警告”
}
},
}

实际行为

引号规则被忽略。
预期行为

应该从第 1 行的引号规则报告警告
“bottomSheet”中提供的片段。
想法

这可能是一个更大的规则问题,但我只观察到它
引号。


您收到此消息是因为您订阅了此线程。
直接回复本邮件,在GitHub上查看
https://github.com/palantir/tslint/issues/2746 ,或静音线程
https://github.com/notifications/unsubscribe-auth/ALaeKN8MtJyisZmnL1SJfgTyAIcaUQPJks5r5IOlgaJpZM4NZfAU
.

所有3条评论

如果您使用带有严重性和选项的新配置格式,您不希望
第一个选项是true 。 如果将其从数组中删除,则规则
应该按预期工作。

上午 12.05.2017 18:07 schrieb“Jacob Robertson”通知@github.com:

错误报告

  • TSLint 版本:5.2.0
  • 打字稿版本:2.3.1
  • 通过以下方式
    grunt-tslint / Atom / Visual Studio / 等

正在整理 TypeScript 代码

import { BottomSheetKey, BottomSheetService } from "bottomSheet"; import { INavItem, NavHeight } from 'core/services/nav.service'; import { Configuration } from './app.configuration';

使用 tslint.json 配置:

{
"defaultSeverity": "错误",
“扩展”:[
tslint:推荐
],
"jsRules": {},
“规则”:{
“引号”:{
"options": [ true, "single", "avoid-escape" ],
“严重性”:“警告”
}
},
}

实际行为

引号规则被忽略。
预期行为

应该从第 1 行的引号规则报告警告
“bottomSheet”中提供的片段。
想法

这可能是一个更大的规则问题,但我只观察到它
引号。


您收到此消息是因为您订阅了此线程。
直接回复本邮件,在GitHub上查看
https://github.com/palantir/tslint/issues/2746 ,或静音线程
https://github.com/notifications/unsubscribe-auth/ALaeKN8MtJyisZmnL1SJfgTyAIcaUQPJks5r5IOlgaJpZM4NZfAU
.

是的,这有效。 谢谢!

我在文档中找不到一个很好的例子来说明如何从

    "rules": {
         "quotemark": [ true, "single", "avoid-escape" ],
    }

    "rules": {
        "quotemark": {
            "options": [ "single", "avoid-escape" ],
            "severity": "warning"
        }
    }

有没有在任何地方提到这种细微的差异?

@jacob-robertson 是的,它位于5.0.0 发行说明变更日志的显着特性和增强部分。

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