clang-format: [JS] do not wrap after `asserts`
authorMartin Probst <martin@probst.io>
Wed, 21 Apr 2021 13:43:41 +0000 (15:43 +0200)
committerMartin Probst <martin@probst.io>
Wed, 21 Apr 2021 14:33:55 +0000 (16:33 +0200)
commit70ae843d99808b19247e968507c0019225597066
treec31b37fef95754a5cfe9bb1adbfb4bdf0a067386
parenta8b35e0f5230c9c12ff9046283137cb907fc1230
clang-format: [JS] do not wrap after `asserts`

`asserts` is a pseudo keyword in TypeScript used in return types.
Wrapping after it triggers automatic semicolon insertion, which
breaks the code semantics/syntax.

`asserts` is different from other pseudo keywords in that it is
specific to TS and only carries meaning in a very specific location.
Thus introducing a token type is probably overkill.

Differential Revision: https://reviews.llvm.org/D100953
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTestJS.cpp