lines-between-class-members
此规则扩展了基本 lines-between-class-members
规则。它添加了对忽略类中重载方法的支持。
选项
除了 js/lines-between-class-members
规则支持的选项外,该规则还添加了以下选项
对象选项
"exceptAfterOverload": true
(默认) - 跳过检查重载类成员后的空行"exceptAfterOverload": false
- 不要 跳过检查重载类成员后的空行
exceptAfterOverload: true
{ "exceptAfterOverload": true }
选项的正确代码示例
ts
/*eslint @stylistic/ts/lines-between-class-members: ["error", "always", { "exceptAfterOverload": true }]*/
class foo {
bar(a: string): void;
bar(a: string, b: string): void;
bar(a: string, b: string) {}
baz() {}
qux() {}
}
exceptAfterOverload: false
{ "exceptAfterOverload": false }
选项的正确代码示例
ts
/*eslint @stylistic/ts/lines-between-class-members: ["error", "always", { "exceptAfterOverload": false }]*/
class foo {
bar(a: string): void;
bar(a: string, b: string): void;
bar(a: string, b: string) {}
baz() {}
qux() {}
}