From c9f52535f8ef2165ed390169b09cf914da0ca970 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 23 Feb 2016 16:36:02 -0800 Subject: [PATCH] Fixed linter warnings --- src/compiler/emitter.ts | 5 ----- src/compiler/factory.ts | 2 +- src/compiler/transformers/jsx.ts | 13 ++++--------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 47547ca94ac..9e74572b60d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -288,11 +288,6 @@ namespace ts { } export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult { - return printFiles(resolver, host, targetSourceFile); - } - - // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - export function legacyEmitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult { // emit output for the __extends helper function const extendsHelper = ` var __extends = (this && this.__extends) || function (d, b) { diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 0720906830f..8f388a01520 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -743,7 +743,7 @@ namespace ts { export function createJsxCreateElement(reactNamespace: string, tagName: Expression, props: Expression, children: Expression[]): LeftHandSideExpression { const argumentsList = [tagName]; if (props) { - argumentsList.push(props) + argumentsList.push(props); } if (children && children.length > 0) { diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 00df9c8abdc..cb1aef32a97 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -40,7 +40,7 @@ namespace ts { function transformJsxChildToExpression(node: JsxChild): Expression { switch (node.kind) { case SyntaxKind.JsxText: - return visitNonEmptyJsxText(node); + return visitJsxText(node); case SyntaxKind.JsxExpression: return visitJsxExpression(node); @@ -69,7 +69,7 @@ namespace ts { let objectProperties: Expression; if (node.attributes.length === 0) { // When there are no attributes, React wants "null" - objectProperties = createLiteral(null); + objectProperties = createNull(); } else { // Either emit one big object literal (no spread attribs), or @@ -124,7 +124,7 @@ namespace ts { return createPropertyAssignment(name, expression); } - function visitNonEmptyJsxText(node: JsxText) { + function visitJsxText(node: JsxText) { const text = getTextToEmit(node); if (text !== undefined) { return createLiteral(text); @@ -155,7 +155,7 @@ namespace ts { const c = text.charCodeAt(i); if (isLineBreak(c)) { if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - let part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); + const part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); result = (result ? result + "\" + ' ' + \"" : "") + part; } firstNonWhitespace = -1; @@ -218,11 +218,6 @@ namespace ts { } } - function visitJsxText(node: JsxText) { - const text = trimReactWhitespaceAndApplyEntities(node); - return createLiteral(text || ""); - } - function visitJsxExpression(node: JsxExpression) { return visitNode(node.expression, visitor, isExpression); }