HomePhabricator

clang-format: [JS] options for arrow functions.

Authored by mprobst on Jan 24 2020, 2:30 AM.

Description

clang-format: [JS] options for arrow functions.

Summary:
clang-format currently always wraps the body of non-empty arrow
functions:

const x = () => {
  z();
};

This change implements support for the AllowShortLambdasOnASingleLine
style options, controlling the indent style for arrow function bodies
that have one or fewer statements. SLS_All puts all on a single line,
SLS_Inline only arrow functions used in an inline position.

const x = () => { z(); };

Multi-statement arrow functions continue to be wrapped. Function
expressions (a = function() {}) and function/method declarations are
unaffected as well.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73335

Details

Committed
mprobstJan 27 2020, 7:27 AM
Differential Revision
D73335: clang-format: [JS] options for arrow functions.
Parents
rG84c3f05c8e3e: [mlir] Harden error propagation in LLVM import
Branches
Unknown
Tags
Unknown