简体   繁体   中英

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) .

I want remove alerts while keeping the tslint config and this is my tslint config:

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

Set allow-leading-underscore .

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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