[英]TSLint member-ordering
I have the following rules in my tslint.json : 我的tslint.json中有以下规则:
"member-ordering": [
true,
{
"order": [
"public-before-private",
"static-before-instance",
"variables-before-functions"
]
}
],
However I still get this warning : 但是我仍然收到此警告:
Warning: member-ordering - Bad member kind: public-before-private
Typescrypt version is 3.1.1 Typescrypt版本是3.1.1
Node version is 10.10.0 节点版本为10.10.0
As the error message says, the values you put in the order
array are not recognized by tslint. 如错误消息所述,tslint无法识别您放入
order
数组中的值。 Read about member-ordering
in the documentation of the member-ordering
rule . 在
member-ordering
规则的文档中阅读有关member-ordering
的信息 。
You can specify in tslint.json
the exact order you want or you can specify only some components (fe let the static methods out) and the missing components can stay anywhere in the class. 您可以在
tslint.json
中指定tslint.json
的确切顺序,也可以仅指定某些组件(可以使用静态方法),而缺少的组件可以保留在类中的任何位置。
The following configuration matches the rules you expressed: 以下配置与您表达的规则匹配:
"member-ordering": [
true,
{
"order": [
"public-static-field",
"public-static-method",
"public-instance-field",
"public-constructor",
"public-instance-method",
"protected-static-field",
"protected-static-method",
"protected-instance-field",
"protected-constructor",
"protected-instance-method",
"private-static-field",
"private-static-method",
"private-instance-field",
"private-constructor",
"private-instance-method"
]
}
],
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.