fix object literal checks in isSimpleCallArgument (#7403)
This commit is contained in:
1 parent
e8009fa102
commit
8efa29ca0c
3 files changed
+58
-3
No files matched your search
@@ -926,9 +926,7 @@ function isSimpleCallArgument(node, depth) {
|
||||
}
|
||||
if (node.type === "ObjectExpression") {
|
||||
return node.properties.every(
|
||||
p =>
|
||||
p.shorthand ||
|
||||
(isSimpleCallArgument(p.key, depth) && isChildSimple(p.value))
|
||||
p => !p.computed && (p.shorthand || (p.value && isChildSimple(p.value)))
|
||||
);
|
||||
}
|
||||
if (node.type === "ArrayExpression") {
|
||||
|
||||
@@ -1176,6 +1176,48 @@ wrapper
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`object-literal.js 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["flow", "typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
of("test")
|
||||
.pipe(throwIfEmpty())
|
||||
.subscribe({
|
||||
error(err) {
|
||||
thrown = err;
|
||||
}
|
||||
});
|
||||
|
||||
of("test")
|
||||
.pipe(throwIfEmpty())
|
||||
.subscribe({
|
||||
get foo() {
|
||||
bar();
|
||||
}
|
||||
});
|
||||
|
||||
=====================================output=====================================
|
||||
of("test")
|
||||
.pipe(throwIfEmpty())
|
||||
.subscribe({
|
||||
error(err) {
|
||||
thrown = err;
|
||||
},
|
||||
});
|
||||
|
||||
of("test")
|
||||
.pipe(throwIfEmpty())
|
||||
.subscribe({
|
||||
get foo() {
|
||||
bar();
|
||||
},
|
||||
});
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`short-names.js 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["flow", "typescript"]
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
of("test")
|
||||
.pipe(throwIfEmpty())
|
||||
.subscribe({
|
||||
error(err) {
|
||||
thrown = err;
|
||||
}
|
||||
});
|
||||
|
||||
of("test")
|
||||
.pipe(throwIfEmpty())
|
||||
.subscribe({
|
||||
get foo() {
|
||||
bar();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user