Consider [0] to be part of the first member group
parent
538ce6d209
commit
979b86944d
|
@ -3723,13 +3723,20 @@ function printMemberChain(path, options, print) {
|
||||||
// The first group is the first node followed by
|
// The first group is the first node followed by
|
||||||
// - as many CallExpression as possible
|
// - as many CallExpression as possible
|
||||||
// < fn()()() >.something()
|
// < fn()()() >.something()
|
||||||
|
// - as many array acessors as possible
|
||||||
|
// < fn()[0][1][2] >.something()
|
||||||
// - then, as many MemberExpression as possible but the last one
|
// - then, as many MemberExpression as possible but the last one
|
||||||
// < this.items >.something()
|
// < this.items >.something()
|
||||||
const groups = [];
|
const groups = [];
|
||||||
let currentGroup = [printedNodes[0]];
|
let currentGroup = [printedNodes[0]];
|
||||||
let i = 1;
|
let i = 1;
|
||||||
for (; i < printedNodes.length; ++i) {
|
for (; i < printedNodes.length; ++i) {
|
||||||
if (printedNodes[i].node.type === "CallExpression") {
|
if (
|
||||||
|
printedNodes[i].node.type === "CallExpression" ||
|
||||||
|
(printedNodes[i].node.type === "MemberExpression" &&
|
||||||
|
printedNodes[i].node.computed &&
|
||||||
|
isNumericLiteral(printedNodes[i].node.property))
|
||||||
|
) {
|
||||||
currentGroup.push(printedNodes[i]);
|
currentGroup.push(printedNodes[i]);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -719,6 +719,10 @@ const version = someLongString
|
||||||
.pop()
|
.pop()
|
||||||
.split(EOL)[0]
|
.split(EOL)[0]
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
|
const component = find('.org-lclp-edit-copy-url-banner__link')[0]
|
||||||
|
.getAttribute('href')
|
||||||
|
.indexOf(this.landingPageLink);
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
const version = someLongString
|
const version = someLongString
|
||||||
.split("jest version =")
|
.split("jest version =")
|
||||||
|
@ -726,6 +730,10 @@ const version = someLongString
|
||||||
.split(EOL)[0]
|
.split(EOL)[0]
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
|
const component = find(".org-lclp-edit-copy-url-banner__link")[0]
|
||||||
|
.getAttribute("href")
|
||||||
|
.indexOf(this.landingPageLink);
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`test.js 1`] = `
|
exports[`test.js 1`] = `
|
||||||
|
|
|
@ -3,3 +3,7 @@ const version = someLongString
|
||||||
.pop()
|
.pop()
|
||||||
.split(EOL)[0]
|
.split(EOL)[0]
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
|
const component = find('.org-lclp-edit-copy-url-banner__link')[0]
|
||||||
|
.getAttribute('href')
|
||||||
|
.indexOf(this.landingPageLink);
|
||||||
|
|
Loading…
Reference in New Issue