Prevent "over-indenting" class properties values (#4085)
parent
a02094961a
commit
41098a06b5
|
@ -436,6 +436,9 @@ function printPathNoParens(path, options, print, args) {
|
|||
const shouldIndentIfInlining =
|
||||
parent.type === "AssignmentExpression" ||
|
||||
parent.type === "VariableDeclarator" ||
|
||||
parent.type === "ClassProperty" ||
|
||||
parent.type === "TSAbstractClassProperty" ||
|
||||
parent.type === "ClassPrivateProperty" ||
|
||||
parent.type === "ObjectProperty" ||
|
||||
parent.type === "Property";
|
||||
|
||||
|
|
|
@ -161,6 +161,25 @@ class C {
|
|||
|
||||
`;
|
||||
|
||||
exports[`property.js 1`] = `
|
||||
class A {
|
||||
foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// comment to break again
|
||||
2;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class A {
|
||||
foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// comment to break again
|
||||
2;
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`ternary.js 1`] = `
|
||||
if (1) (class {}) ? 1 : 2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class A {
|
||||
foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// comment to break again
|
||||
2;
|
||||
}
|
|
@ -173,3 +173,41 @@ class Point {
|
|||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`with_comments.js 1`] = `
|
||||
class A {
|
||||
#foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// comment to break again
|
||||
2;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class A {
|
||||
#foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// comment to break again
|
||||
2;
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`with_comments.js 2`] = `
|
||||
class A {
|
||||
#foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// comment to break again
|
||||
2;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class A {
|
||||
#foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// comment to break again
|
||||
2
|
||||
}
|
||||
|
||||
`;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class A {
|
||||
#foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// comment to break again
|
||||
2;
|
||||
}
|
|
@ -61,3 +61,22 @@ abstract class Foo {
|
|||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`abstractPropertiesWithBreaks.ts 1`] = `
|
||||
abstract class Foo {
|
||||
abstract private foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// another comment to break
|
||||
2;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
abstract class Foo {
|
||||
private abstract foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// another comment to break
|
||||
2;
|
||||
}
|
||||
|
||||
`;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
abstract class Foo {
|
||||
abstract private foobar =
|
||||
// comment to break
|
||||
1 +
|
||||
// another comment to break
|
||||
2;
|
||||
}
|
Loading…
Reference in New Issue