As I like the "lines-between-class-members"
rule, I'd like to enforce spaces between my classes' functions, but in the same time I want the properties declarations packed at the beginning of my classes in the following format:
class Foo {
a: number;
b: number;
c: string;
d: string;
constructor() {
// constructor stuff
}
doSomething() {
// do something
}
}
Is there a way to ignore this rule specifically on types declarations?
As I like the "lines-between-class-members"
rule, I'd like to enforce spaces between my classes' functions, but in the same time I want the properties declarations packed at the beginning of my classes in the following format:
class Foo {
a: number;
b: number;
c: string;
d: string;
constructor() {
// constructor stuff
}
doSomething() {
// do something
}
}
Is there a way to ignore this rule specifically on types declarations?
Share Improve this question edited Jun 24, 2020 at 11:05 GalAbra asked Jun 24, 2020 at 10:48 GalAbraGalAbra 5,1485 gold badges25 silver badges43 bronze badges3 Answers
Reset to default 20It seems like you'll have to do this
'lines-between-class-members': [
'error',
'always',
{ 'exceptAfterSingleLine': true },
]
Docs It will skips checks for empty lines after a single-line class member.
add the rule into the .eslintrc.js
lines-between-class-members: ["error", "never"]
also, this link will be more helpful: https://eslint.org/docs/rules/lines-between-class-members
Please add this hopefully it will work:
/* eslint-disable no-trailing-spaces */