Fix lint errors

This commit is contained in:
Andrew Casey
2018-02-12 18:29:01 -08:00
parent 5656f35b6a
commit 979b14689e
2 changed files with 8 additions and 3 deletions

View File

@@ -56,7 +56,9 @@ namespace ts {
it("Sort - invalid vs invalid", () => {
assertSortsBefore(
// tslint:disable-next-line no-invalid-template-strings
"import y from `${'lib1'}`;",
// tslint:disable-next-line no-invalid-template-strings
"import x from `${'lib2'}`;");
});
@@ -69,12 +71,14 @@ namespace ts {
it("Sort - non-relative vs invalid", () => {
assertSortsBefore(
`import y from "lib";`,
// tslint:disable-next-line no-invalid-template-strings
"import x from `${'lib'}`;");
});
it("Sort - relative vs invalid", () => {
assertSortsBefore(
`import y from "./lib";`,
// tslint:disable-next-line no-invalid-template-strings
"import x from `${'lib'}`;");
});
@@ -357,7 +361,7 @@ F2();
assert.equal(node1.kind, node2.kind);
switch(node1.kind) {
switch (node1.kind) {
case SyntaxKind.ImportDeclaration:
const decl1 = node1 as ImportDeclaration;
const decl2 = node2 as ImportDeclaration;
@@ -369,6 +373,7 @@ F2();
const clause2 = node2 as ImportClause;
assertEqual(clause1.name, clause2.name);
assertEqual(clause1.namedBindings, clause2.namedBindings);
break;
case SyntaxKind.NamespaceImport:
const nsi1 = node1 as NamespaceImport;
const nsi2 = node2 as NamespaceImport;

View File

@@ -2368,7 +2368,7 @@ namespace ts {
const name = getExternalModuleName(specifier);
if (name) {
const isRelative = isExternalModuleNameRelative(name);
return { importDeclaration, name, kind: isRelative ? ModuleNameKind.Relative : ModuleNameKind.NonRelative }
return { importDeclaration, name, kind: isRelative ? ModuleNameKind.Relative : ModuleNameKind.NonRelative };
}
return { importDeclaration, name: specifier.getText(), kind: ModuleNameKind.Invalid };
@@ -2505,7 +2505,7 @@ namespace ts {
const sortedImportSpecifiers = stableSort(newImportSpecifiers, (s1, s2) => {
const nameComparison = compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name);
return nameComparison != Comparison.EqualTo
return nameComparison !== Comparison.EqualTo
? nameComparison
: compareIdentifiers(s1.name, s2.name);
});