[英]Angular TSLint: Only allow camelCase, do Not allow Pascal case
We are writing code in Angular, and only want to allow lower-case first letter, Camel case.我们正在用 Angular 编写代码,并且只想允许小写首字母,Camel 大小写。 For example, ProductName should show a display warning/error (since its capitalized).
例如,ProductName 应该显示一个显示警告/错误(因为它是大写的)。
How can I allow only camelCase in TSLint, and not allow Pascal (Uppercase)?如何在 TSLint 中只允许驼峰命名,而不允许 Pascal(大写)?
this.product.ProductName = 5;
The following is not showing errors in usage, only in the Class component itself,以下不显示使用错误,仅显示在 Class 组件本身,
export class Product {
ProductId: number;
ProductName: string;
}
TS Lint Settings: TS 棉绒设置:
"variable-name": {
"options": [
"ban-keywords",
"check-format"
]
} , } ,
https://palantir.github.io/tslint/rules/variable-name/ https://palantir.github.io/tslint/rules/variable-name/
Set allow-pascal-case.设置允许帕斯卡案例。
"variable-name": {
"options": [
"ban-keywords",
"check-format",
"allow-pascal-case",
"allow-leading-underscore"
]
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.