简体   繁体   English

如何使 tslint 接受以“_”开头的变量名

[英]How to make tslint accept variable name with “_” at the beginning

I have a require of customer that say to need "_" symbol.我有一个客户说需要"_"符号。 I added this like that:我是这样添加的:

public _someVariable: string;

but tslint say variable name must be in lowerCamelCase, PascalCase or UPPER_CASE (variable-name) .但是 tslint 说variable name must be in lowerCamelCase, PascalCase or UPPER_CASE (variable-name)

I want remove alerts while keeping the tslint config and this is my tslint config:我想在保留 tslint 配置的同时删除警报,这是我的 tslint 配置:

"variable-name": {
  "options": [
    "ban-keywords",
    "check-format",
    "allow-pascal-case"
  ]
},

Set allow-leading-underscore .设置allow-leading-underscore

"variable-name": {
  "options": [
    "ban-keywords",
    "check-format",
    "allow-pascal-case",
    "allow-leading-underscore"
  ]
},

https://palantir.github.io/tslint/rules/variable-name/ https://palantir.github.io/tslint/rules/variable-name/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM