Index: clang/lib/Format/SortJavaScriptImports.cpp =================================================================== --- clang/lib/Format/SortJavaScriptImports.cpp +++ clang/lib/Format/SortJavaScriptImports.cpp @@ -409,7 +409,7 @@ nextToken(); if (Current->is(tok::r_brace)) break; - if (!Current->isOneOf(tok::identifier, tok::kw_default)) + if (!Current->isOneOf(tok::identifier, tok::kw_default, tok::kw_template)) return false; JsImportedSymbol Symbol; Index: clang/unittests/Format/SortImportsTestJS.cpp =================================================================== --- clang/unittests/Format/SortImportsTestJS.cpp +++ clang/unittests/Format/SortImportsTestJS.cpp @@ -307,6 +307,14 @@ "import {A} from 'a';\n"); } +TEST_F(SortImportsTestJS, TemplateKeyword) { + // Reproduces issue where importing "template" disables imports sorting. + verifySort("import {template} from './a';\n" + "import {b} from './b';\n", + "import {b} from './b';\n" + "import {template} from './a';\n"); +} + } // end namespace } // end namespace format } // end namespace clang