Short rule should only apply to the first identifier (#4575)

master
Lucas Duailibe 2018-05-27 21:52:42 -03:00 committed by GitHub
parent 2505926533
commit a6db391556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 3 deletions

View File

@ -4477,9 +4477,7 @@ function printMemberChain(path, options, print) {
(lastNode.type === "MemberExpression" ||
lastNode.type === "OptionalMemberExpression") &&
lastNode.property.type === "Identifier" &&
(isFactory(lastNode.property.name) ||
(isExpression && isShort(lastNode.property.name)) ||
hasComputed)
(isFactory(lastNode.property.name) || hasComputed)
);
}

View File

@ -494,6 +494,15 @@ d3.select('body')
d3.scaleLinear()
.domain([1950, 1980])
.range([0, width])
not.d3.select('body')
.append('circle')
.at({ width: 30, fill: '#f0f' })
.st({ fontWeight: 600 })
not.d3.scaleLinear()
.domain([1950, 1980])
.range([0, width])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d3.select("body")
.append("circle")
@ -504,6 +513,17 @@ d3.scaleLinear()
.domain([1950, 1980])
.range([0, width]);
not.d3
.select("body")
.append("circle")
.at({ width: 30, fill: "#f0f" })
.st({ fontWeight: 600 });
not.d3
.scaleLinear()
.domain([1950, 1980])
.range([0, width]);
`;
exports[`first_long.js 1`] = `

View File

@ -6,3 +6,12 @@ d3.select('body')
d3.scaleLinear()
.domain([1950, 1980])
.range([0, width])
not.d3.select('body')
.append('circle')
.at({ width: 30, fill: '#f0f' })
.st({ fontWeight: 600 })
not.d3.scaleLinear()
.domain([1950, 1980])
.range([0, width])