[PATCH] D118361: clang-format: [JS] sort import aliases.

Martin Probst via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 27 06:35:53 PST 2022


mprobst created this revision.
mprobst added a reviewer: krasimir.
Herald added a subscriber: jeroen.dobbelaere.
mprobst requested review of this revision.
Herald added a project: clang.

Users can define aliases for long symbols using import aliases:

  import X = A.B.C;

Previously, these were unhandled and would terminate import sorting.
With this change, aliases sort as their own group, coming last after all
other imports.

Aliases are not sorted within their group, as they may reference each
other, so order is significant. Aliases sort before ES module exports,
as exports may reference aliases.

  import {A} from 'foo';
  
  import X = A.B.C;
  
  export {X};


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118361

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118361.403633.patch
Type: text/x-patch
Size: 6683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220127/14f9899c/attachment.bin>


More information about the cfe-commits mailing list