Skip to content

Commit 91f0346

Browse files
committed
Conform lint of the future, unify quotations
1 parent 5a6d476 commit 91f0346

21 files changed

+592
-592
lines changed

src/compiler/binder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ namespace ts {
139139
function getDeclarationName(node: Declaration): string {
140140
if (node.name) {
141141
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
142-
return '"' + (<LiteralExpression>node.name).text + '"';
142+
return `"${(<LiteralExpression>node.name).text}"`;
143143
}
144144
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
145145
let nameExpression = (<ComputedPropertyName>node.name).expression;
@@ -830,7 +830,7 @@ namespace ts {
830830

831831
// Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the
832832
// string to contain unicode escapes (as per ES5).
833-
return nodeText === '"use strict"' || nodeText === "'use strict'";
833+
return nodeText === "\"use strict\"" || nodeText === "'use strict'";
834834
}
835835

836836
function bindWorker(node: Node) {
@@ -930,7 +930,7 @@ namespace ts {
930930
function bindSourceFileIfExternalModule() {
931931
setExportContextFlag(file);
932932
if (isExternalModule(file)) {
933-
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, '"' + removeFileExtension(file.fileName) + '"');
933+
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName)}"`);
934934
}
935935
}
936936

src/compiler/checker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ namespace ts {
968968
if (!moduleName) return;
969969
let isRelative = isExternalModuleNameRelative(moduleName);
970970
if (!isRelative) {
971-
let symbol = getSymbol(globals, '"' + moduleName + '"', SymbolFlags.ValueModule);
971+
let symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule);
972972
if (symbol) {
973973
return symbol;
974974
}
@@ -7338,7 +7338,7 @@ namespace ts {
73387338
}
73397339

73407340
// Wasn't found
7341-
error(node, Diagnostics.Property_0_does_not_exist_on_type_1, (<Identifier>node.tagName).text, 'JSX.' + JsxNames.IntrinsicElements);
7341+
error(node, Diagnostics.Property_0_does_not_exist_on_type_1, (<Identifier>node.tagName).text, "JSX." + JsxNames.IntrinsicElements);
73427342
return unknownSymbol;
73437343
}
73447344
else {
@@ -7558,7 +7558,7 @@ namespace ts {
75587558
// be marked as 'used' so we don't incorrectly elide its import. And if there
75597559
// is no 'React' symbol in scope, we should issue an error.
75607560
if (compilerOptions.jsx === JsxEmit.React) {
7561-
let reactSym = resolveName(node.tagName, 'React', SymbolFlags.Value, Diagnostics.Cannot_find_name_0, 'React');
7561+
let reactSym = resolveName(node.tagName, "React", SymbolFlags.Value, Diagnostics.Cannot_find_name_0, "React");
75627562
if (reactSym) {
75637563
getSymbolLinks(reactSym).referenced = true;
75647564
}

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ namespace ts {
335335
* @param fileName The path to the config file
336336
*/
337337
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
338-
let text = '';
338+
let text = "";
339339
try {
340340
text = sys.readFile(fileName);
341341
}

src/compiler/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ namespace ts {
523523
if (path.lastIndexOf("file:///", 0) === 0) {
524524
return "file:///".length;
525525
}
526-
let idx = path.indexOf('://');
526+
let idx = path.indexOf("://");
527527
if (idx !== -1) {
528528
return idx + "://".length;
529529
}

src/compiler/emitter.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
380380
function base64VLQFormatEncode(inValue: number) {
381381
function base64FormatEncode(inValue: number) {
382382
if (inValue < 64) {
383-
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(inValue);
383+
return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue);
384384
}
385385
throw TypeError(inValue + ": not a 64 based value");
386386
}
@@ -895,7 +895,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
895895
// Any template literal or string literal with an extended escape
896896
// (e.g. "\u{0067}") will need to be downleveled as a escaped string literal.
897897
if (languageVersion < ScriptTarget.ES6 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {
898-
return getQuotedEscapedLiteralText('"', node.text, '"');
898+
return getQuotedEscapedLiteralText("\"", node.text, "\"");
899899
}
900900

901901
// If we don't need to downlevel and we can reach the original source text using
@@ -908,15 +908,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
908908
// or an escaped quoted form of the original text if it's string-like.
909909
switch (node.kind) {
910910
case SyntaxKind.StringLiteral:
911-
return getQuotedEscapedLiteralText('"', node.text, '"');
911+
return getQuotedEscapedLiteralText("\"", node.text, "\"");
912912
case SyntaxKind.NoSubstitutionTemplateLiteral:
913-
return getQuotedEscapedLiteralText('`', node.text, '`');
913+
return getQuotedEscapedLiteralText("`", node.text, "`");
914914
case SyntaxKind.TemplateHead:
915-
return getQuotedEscapedLiteralText('`', node.text, '${');
915+
return getQuotedEscapedLiteralText("`", node.text, "${");
916916
case SyntaxKind.TemplateMiddle:
917-
return getQuotedEscapedLiteralText('}', node.text, '${');
917+
return getQuotedEscapedLiteralText("}", node.text, "${");
918918
case SyntaxKind.TemplateTail:
919-
return getQuotedEscapedLiteralText('}', node.text, '`');
919+
return getQuotedEscapedLiteralText("}", node.text, "`");
920920
case SyntaxKind.NumericLiteral:
921921
return node.text;
922922
}
@@ -947,7 +947,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
947947
text = text.replace(/\r\n?/g, "\n");
948948
text = escapeString(text);
949949

950-
write('"' + text + '"');
950+
write(`"${text}"`);
951951
}
952952

953953
function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression) => void) {
@@ -1134,9 +1134,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
11341134
/// 'Div' for upper-cased or dotted names
11351135
function emitTagName(name: Identifier|QualifiedName) {
11361136
if (name.kind === SyntaxKind.Identifier && isIntrinsicJsxName((<Identifier>name).text)) {
1137-
write('"');
1137+
write("\"");
11381138
emit(name);
1139-
write('"');
1139+
write("\"");
11401140
}
11411141
else {
11421142
emit(name);
@@ -1148,9 +1148,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
11481148
/// about keywords, just non-identifier characters
11491149
function emitAttributeName(name: Identifier) {
11501150
if (/[A-Za-z_]+[\w*]/.test(name.text)) {
1151-
write('"');
1151+
write("\"");
11521152
emit(name);
1153-
write('"');
1153+
write("\"");
11541154
}
11551155
else {
11561156
emit(name);
@@ -1249,9 +1249,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
12491249
if (children[i].kind === SyntaxKind.JsxText) {
12501250
let text = getTextToEmit(<JsxText>children[i]);
12511251
if (text !== undefined) {
1252-
write(', "');
1252+
write(", \"");
12531253
write(text);
1254-
write('"');
1254+
write("\"");
12551255
}
12561256
}
12571257
else {
@@ -1491,7 +1491,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
14911491
if (declaration.kind === SyntaxKind.ImportClause) {
14921492
// Identifier references default import
14931493
write(getGeneratedNameForNode(<ImportDeclaration>declaration.parent));
1494-
write(languageVersion === ScriptTarget.ES3 ? '["default"]' : ".default");
1494+
write(languageVersion === ScriptTarget.ES3 ? "[\"default\"]" : ".default");
14951495
return;
14961496
}
14971497
else if (declaration.kind === SyntaxKind.ImportSpecifier) {
@@ -6440,7 +6440,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
64406440
if (isLineBreak(c)) {
64416441
if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) {
64426442
let part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1);
6443-
result = (result ? result + '" + \' \' + "' : '') + part;
6443+
result = (result ? result + "\" + ' ' + \"" : "") + part;
64446444
}
64456445
firstNonWhitespace = -1;
64466446
}
@@ -6453,7 +6453,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
64536453
}
64546454
if (firstNonWhitespace !== -1) {
64556455
let part = text.substr(firstNonWhitespace);
6456-
result = (result ? result + '" + \' \' + "' : '') + part;
6456+
result = (result ? result + "\" + ' ' + \"" : "") + part;
64576457
}
64586458

64596459
return result;
@@ -6478,9 +6478,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
64786478
function emitJsxText(node: JsxText) {
64796479
switch (compilerOptions.jsx) {
64806480
case JsxEmit.React:
6481-
write('"');
6481+
write("\"");
64826482
write(trimReactWhitespace(node));
6483-
write('"');
6483+
write("\"");
64846484
break;
64856485

64866486
case JsxEmit.Preserve:
@@ -6495,9 +6495,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
64956495
switch (compilerOptions.jsx) {
64966496
case JsxEmit.Preserve:
64976497
default:
6498-
write('{');
6498+
write("{");
64996499
emit(node.expression);
6500-
write('}');
6500+
write("}");
65016501
break;
65026502
case JsxEmit.React:
65036503
emit(node.expression);

src/compiler/parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3340,7 +3340,7 @@ namespace ts {
33403340
case SyntaxKind.LessThanToken:
33413341
return parseJsxElementOrSelfClosingElement();
33423342
}
3343-
Debug.fail('Unknown JSX child kind ' + token);
3343+
Debug.fail("Unknown JSX child kind " + token);
33443344
}
33453345

33463346
function parseJsxChildren(openingTagName: EntityName): NodeArray<JsxChild> {
@@ -6011,7 +6011,7 @@ namespace ts {
60116011
return;
60126012

60136013
function visitNode(node: IncrementalNode) {
6014-
let text = '';
6014+
let text = "";
60156015
if (aggressiveChecks && shouldCheckNode(node)) {
60166016
text = oldText.substring(node.pos, node.end);
60176017
}

src/compiler/sys.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace ts {
3030
declare var global: any;
3131
declare var __filename: string;
3232
declare var Buffer: {
33-
new (str: string, encoding ?: string): any;
33+
new (str: string, encoding?: string): any;
3434
};
3535

3636
declare class Enumerator {
@@ -190,7 +190,7 @@ namespace ts {
190190
function getNodeSystem(): System {
191191
const _fs = require("fs");
192192
const _path = require("path");
193-
const _os = require('os');
193+
const _os = require("os");
194194

195195
const platform: string = _os.platform();
196196
// win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive
@@ -228,7 +228,7 @@ namespace ts {
228228
function writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void {
229229
// If a BOM is required, emit one
230230
if (writeByteOrderMark) {
231-
data = '\uFEFF' + data;
231+
data = "\uFEFF" + data;
232232
}
233233

234234
_fs.writeFileSync(fileName, data, "utf8");
@@ -271,7 +271,7 @@ namespace ts {
271271
newLine: _os.EOL,
272272
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
273273
write(s: string): void {
274-
const buffer = new Buffer(s, 'utf8');
274+
const buffer = new Buffer(s, "utf8");
275275
let offset: number = 0;
276276
let toWrite: number = buffer.length;
277277
let written = 0;

src/compiler/tsc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ namespace ts {
245245
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
246246
}
247247

248-
function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError ?: (message: string) => void) {
248+
function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) {
249249
// Return existing SourceFile object if one is available
250250
if (cachedProgram) {
251251
let sourceFile = cachedProgram.getSourceFile(fileName);

src/compiler/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ namespace ts {
18661866

18671867
function writeTrimmedCurrentLine(pos: number, nextLineStart: number) {
18681868
let end = Math.min(comment.end, nextLineStart - 1);
1869-
let currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, '');
1869+
let currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, "");
18701870
if (currentLineText) {
18711871
// trimmed forward and ending spaces text
18721872
writer.write(currentLineText);

0 commit comments

Comments
 (0)