Skip to content
Permalink
Browse files

Update: handle indentation of custom destructuring syntax (fixes #8990)…

… (#9027)
  • Loading branch information...
not-an-aardvark committed Jul 30, 2017
1 parent cdb82f2 commit 7247b6cff70ad5d5aeea27ec893e675238cb8e8d
@@ -960,11 +960,20 @@ module.exports = {

return {
"ArrayExpression, ArrayPattern"(node) {
addElementListIndent(node.elements, sourceCode.getFirstToken(node), sourceCode.getLastToken(node), options.ArrayExpression);
const openingBracket = sourceCode.getFirstToken(node);
const closingBracket = sourceCode.getTokenAfter(lodash.findLast(node.elements) || openingBracket, astUtils.isClosingBracketToken);

addElementListIndent(node.elements, openingBracket, closingBracket, options.ArrayExpression);
},

"ObjectExpression, ObjectPattern"(node) {
addElementListIndent(node.properties, sourceCode.getFirstToken(node), sourceCode.getLastToken(node), options.ObjectExpression);
const openingCurly = sourceCode.getFirstToken(node);
const closingCurly = sourceCode.getTokenAfter(
node.properties.length ? node.properties[node.properties.length - 1] : openingCurly,
astUtils.isClosingBraceToken
);

addElementListIndent(node.properties, openingCurly, closingCurly, options.ObjectExpression);
},

ArrowFunctionExpression(node) {
Oops, something went wrong.

0 comments on commit 7247b6c

Please sign in to comment.
You can’t perform that action at this time.