]> granicus.if.org Git - clang/commit
clang-format: [JS] sort ES6 imports.
authorMartin Probst <martin@probst.io>
Fri, 20 May 2016 11:24:24 +0000 (11:24 +0000)
committerMartin Probst <martin@probst.io>
Fri, 20 May 2016 11:24:24 +0000 (11:24 +0000)
commit3e258a6c0fc66ab33b992bda96fbc7dc2e779089
tree679c111fd7e32b5b76781f6fcb2f236627461472
parentb01e846494bf1b34459689a49ea3d9b8530788f8
clang-format: [JS] sort ES6 imports.

Summary:
This change automatically sorts ES6 imports and exports into four groups:
absolute imports, parent imports, relative imports, and then exports. Exports
are sorted in the same order, but not grouped further.

To keep JS import sorting out of Format.cpp, this required extracting the
TokenAnalyzer infrastructure to separate header and implementation files.

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D20198

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270203 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
include/clang/Format/Format.h
lib/Format/CMakeLists.txt
lib/Format/Format.cpp
lib/Format/FormatToken.h
lib/Format/FormatTokenLexer.cpp [new file with mode: 0644]
lib/Format/FormatTokenLexer.h [new file with mode: 0644]
lib/Format/SortJavaScriptImports.cpp [new file with mode: 0644]
lib/Format/SortJavaScriptImports.h [new file with mode: 0644]
lib/Format/TokenAnalyzer.cpp [new file with mode: 0644]
lib/Format/TokenAnalyzer.h [new file with mode: 0644]
unittests/Format/CMakeLists.txt
unittests/Format/SortImportsTestJS.cpp [new file with mode: 0644]