style: run linter
MODIFY
internal/formatter/builders/js/typescript/TSIntersectionTypeAnnotation.ts
internal/formatter/builders/js/typescript/TSIntersectionTypeAnnotation.ts
@@ -39,12 +39,7 @@ export default function TSIntersectionTypeAnnotation(
// d: string;
// };
parts.push(space, "&", space, shouldIndent ? indent(printed) : printed);
- } else if (!(isObjectType(previous) || isObjectType(type))) {
- // let foo: XXXX &
- // YYYY &&
- // ZZZZ;
- parts.push(indent(concat([space, "&", lineOrSpace, printed])));
- } else {
+ } else if (isObjectType(previous) || isObjectType(type)) {
// let z: AAA & {
// a: string;
// b: string;
@@ -58,6 +53,11 @@ export default function TSIntersectionTypeAnnotation(
}
parts.push(space, "&", space, shouldIndent ? indent(printed) : printed);
+ } else {
+ // let foo: XXXX &
+ // YYYY &&
+ // ZZZZ;
+ parts.push(indent(concat([space, "&", lineOrSpace, printed])));
}
previous = type;

MODIFY
internal/string-diff/index.ts
internal/string-diff/index.ts
@@ -610,9 +610,8 @@ export function halfMatch(text1: string, text2: string): undefined | HalfMatch {
let hm2 = halfMatchI(longtext, shorttext, Math.ceil(longtext.length / 2));
let hm: undefined | HalfMatch;
- if (!(hm1 || hm2)) {
- return undefined;
- } else if (hm2) {
+ if (hm1 || hm2) {
+ if (hm2) {
if (hm1) {
// Both matched. Select the longest.
hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
@@ -622,6 +621,9 @@ export function halfMatch(text1: string, text2: string): undefined | HalfMatch {
} else {
hm = hm1;
}
+ } else {
+ return undefined;
+ }
if (hm === undefined) {
throw new Error("Expected half match");

style: run linter