Enable 'no-invalid-template-strings' lint rule (#19790)

This commit is contained in:
Andy 2017-11-07 06:51:35 -08:00 committed by GitHub
parent d81ea525c4
commit 9c8129eeac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 1 deletions

View File

@ -363,8 +363,10 @@ namespace ts {
case SyntaxKind.NoSubstitutionTemplateLiteral:
return "`" + escapeText(node.text, CharacterCodes.backtick) + "`";
case SyntaxKind.TemplateHead:
// tslint:disable-next-line no-invalid-template-strings
return "`" + escapeText(node.text, CharacterCodes.backtick) + "${";
case SyntaxKind.TemplateMiddle:
// tslint:disable-next-line no-invalid-template-strings
return "}" + escapeText(node.text, CharacterCodes.backtick) + "${";
case SyntaxKind.TemplateTail:
return "}" + escapeText(node.text, CharacterCodes.backtick) + "`";

View File

@ -55,6 +55,7 @@ namespace ts {
printsCorrectly("removeComments", { removeComments: true }, printer => printer.printFile(sourceFile));
// github #14948
// tslint:disable-next-line no-invalid-template-strings
printsCorrectly("templateLiteral", {}, printer => printer.printFile(createSourceFile("source.ts", "let greeting = `Hi ${name}, how are you?`;", ScriptTarget.ES2017)));
// github #18071

View File

@ -1,5 +1,7 @@
/// <reference path="..\..\harnessLanguageService.ts" />
// tslint:disable no-invalid-template-strings (lots of tests use quoted code)
interface ClassificationEntry {
value: any;
classification: ts.TokenClass;

View File

@ -89,7 +89,6 @@
"no-empty": false,
"no-empty-interface": false,
"no-eval": false,
"no-invalid-template-strings": false,
"no-object-literal-type-assertion": false,
"no-shadowed-variable": false,
"no-submodule-imports": false,