[PATCH] D150116: clang-format: [JS] support import/export type

Jan Kühle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 8 06:41:06 PDT 2023


jankuehle created this revision.
jankuehle added a project: clang-format.
Herald added projects: All, clang.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan, MyDeveloperDay.
jankuehle requested review of this revision.

Users can choose to only import/export the type of the symbol (not value nor namespace) by adding a `type` keyword, e.g.:

  import type {x} from 'y';
  import {type x} from 'y';
  export type {x};
  export {type x};

Previously, this was not handled and would:

- Terminate import sorting
- Remove the space before the curly bracket in `export type {`

With this change, both formatting and import sorting work as expected.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150116

Files:
  clang/lib/Format/SortJavaScriptImports.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTestJS.cpp
  clang/unittests/Format/SortImportsTestJS.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150116.520345.patch
Type: text/x-patch
Size: 5904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230508/f64d846e/attachment.bin>


More information about the cfe-commits mailing list