TSLint : variable name must be in camelcase or uppercase
You can solve the problem by editing your tslint.json
and adding "allow-leading-underscore"
to the "variable-name"
array of your "rules"
.
// tslint.json contents
{
// ...
"rules": {
// ...
"variable-name": [
true,
// ...
"allow-leading-underscore"
]
},
// ...
}
I have updated tslint.json
, configured the file and added optional arguments to the array of variable-name.
"allow-leading-underscore"
allows underscores at the beginning (only has an effect if “check-format” specified)
"allow-pascal-case"
allows PascalCase in addition to lowerCamelCase.
"allow-snake-case"
allows snake_case in addition to lowerCamelCase.
"allow-trailing-underscore"
allows underscores at the end. (only has an effect if “check-format” specified)
{
// ...
"rules": {
"variable-name": [
true,
"allow-leading-underscore"
],
},
// ...
}
You can configure tslint.json
according to your requirements.
This link might be helpful. https://palantir.github.io/tslint/rules/variable-name/