Clang-format typescript
Clang format all the typescript files, and add a presubmit. The
typescript can now be formatted using git cl format --js.
There are two clang-format configuration that is different from Google
style (see ui/.clang-format):
1. BinPackArguments: false. These screenshots explain why:
BinPackArguments: true - https://screenshot.googleplex.com/XqO41cJ5477
BinPackArguments: false - https://screenshot.googleplex.com/rHHH1Y801Tm
2. JavaScriptWrapImports: true, Clang format doesn't solve long import
lines otherwise, which trigger the existing long line presubmit
warning.
JavaScriptWrapImports: false -
https://screenshot.googleplex.com/hze5RLywgn6
JavascriptWrapImports: true -
https://screenshot.googleplex.com/tkOky2Jhrqy
The main config files to review in this CL are PRESUBMIT.py and
ui/.clang-format.
Bug:111101465
Change-Id: I47f39ecb23fea69dc15ff6cac16fc214c3179877
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 7168e8f..b2d38a6 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -25,7 +25,8 @@
results += input.canned_checks.CheckChangeHasNoTabs(input, output)
results += input.canned_checks.CheckLongLines(
input, output, 80, source_file_filter=long_line_sources)
- results += input.canned_checks.CheckPatchFormatted(input, output)
+ results += input.canned_checks.CheckPatchFormatted(
+ input, output, check_js=True)
results += input.canned_checks.CheckGNFormatted(input, output)
results += CheckIncludeGuards(input, output)
results += CheckAndroidBlueprint(input, output)