From 042f1fc4a8ca9fa51c52480bb8f97025f689b913 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 29 Jun 2015 09:07:12 -0700 Subject: [PATCH] Update for style :tophat: --- src/compiler/checker.ts | 8 +++--- src/compiler/emitter.ts | 60 ++++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f3f87f05c0e..019fd8faf36 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6764,7 +6764,7 @@ namespace ts { */ function isUnhyphenatedJsxName(name: string) { // - is the only character supported in JSX attribute names that isn't valid in JavaScript identifiers - return name.indexOf('-') < 0; + return name.indexOf("-") < 0; } /** @@ -6961,7 +6961,7 @@ namespace ts { /// e.g. "props" for React.d.ts, /// or 'undefined' if ElementAttributesPropery doesn't exist (which means all /// non-intrinsic elements' attributes type is 'any'), - /// or '' if it has 0 properties (which means all + /// or '' if it has 0 properties (which means every /// non-instrinsic elements' attributes type is the element instance type) function getJsxElementPropertiesName() { // JSX @@ -6976,7 +6976,7 @@ namespace ts { if (attribProperties) { // Element Attributes has zero properties, so the element attributes type will be the class instance type if (attribProperties.length === 0) { - return ''; + return ""; } // Element Attributes has one property, so the element attributes type will be the type of the corresponding // property of the class instance type @@ -7016,7 +7016,7 @@ namespace ts { // There is no type ElementAttributesProperty, return 'any' return links.resolvedJsxType = anyType; } - else if (propsName === '') { + else if (propsName === "") { // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead return links.resolvedJsxType = elemInstanceType; } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3b1a1609c39..4e6bc5f687d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1140,80 +1140,80 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { /// Emit an name/value pair for an attribute (e.g. "x: 3") function emitJsxAttribute(node: JsxAttribute) { emitAttributeName(node.name); - write(': '); + write(": "); if (node.initializer) { emit(node.initializer); } else { - write('true'); + write("true"); } } function emitJsxElement(openingNode: JsxOpeningLikeElement, children?: JsxChild[]) { // Call React.createElement(tag, ... emitLeadingComments(openingNode); - write('React.createElement('); + write("React.createElement("); emitTagName(openingNode.tagName); - write(', '); + write(", "); // Attribute list if (openingNode.attributes.length === 0) { - // When there are no attributes, React wants 'null' - write('null'); + // When there are no attributes, React wants "null" + write("null"); } else { // Either emit one big object literal (no spread attribs), or // a call to React.__spread let attrs = openingNode.attributes; if (attrs.some(attr => attr.kind === SyntaxKind.JsxSpreadAttribute)) { - write('React.__spread('); + write("React.__spread("); let haveOpenedObjectLiteral = false; for (let i = 0; i < attrs.length; i++) { if (attrs[i].kind === SyntaxKind.JsxSpreadAttribute) { // If this is the first argument, we need to emit a {} as the first argument if (i === 0) { - write('{}, '); + write("{}, "); } if (haveOpenedObjectLiteral) { - write('}'); + write("}"); haveOpenedObjectLiteral = false; } if (i > 0) { - write(', '); + write(", "); } emit((attrs[i]).expression); } else { Debug.assert(attrs[i].kind === SyntaxKind.JsxAttribute); if (haveOpenedObjectLiteral) { - write(', '); + write(", "); } else { haveOpenedObjectLiteral = true; if (i > 0) { - write(', '); + write(", "); } - write('{'); + write("{"); } emitJsxAttribute(attrs[i]); } } - if (haveOpenedObjectLiteral) write('}'); + if (haveOpenedObjectLiteral) write("}"); - write(')'); // closing paren to React.__spread( + write(")"); // closing paren to React.__spread( } else { // One object literal with all the attributes in them - write('{'); + write("{"); for (var i = 0; i < attrs.length; i++) { if (i > 0) { - write(', '); + write(", "); } emitJsxAttribute(attrs[i]); } - write('}'); + write("}"); } } @@ -1235,7 +1235,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } } else { - write(', '); + write(", "); emit(children[i]); } @@ -1243,7 +1243,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } // Closing paren - write(')'); // closes 'React.createElement(' + write(")"); // closes "React.createElement(" emitTrailingComments(openingNode); } @@ -1259,20 +1259,20 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { function jsxEmitPreserve(node: JsxElement|JsxSelfClosingElement) { function emitJsxAttribute(node: JsxAttribute) { emit(node.name); - write('='); + write("="); emit(node.initializer); } function emitJsxSpreadAttribute(node: JsxSpreadAttribute) { - write('{...'); + write("{..."); emit(node.expression); - write('}'); + write("}"); } function emitAttributes(attribs: NodeArray) { for (let i = 0, n = attribs.length; i < n; i++) { if (i > 0) { - write(' '); + write(" "); } if (attribs[i].kind === SyntaxKind.JsxSpreadAttribute) { @@ -1286,26 +1286,26 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } function emitJsxOpeningOrSelfClosingElement(node: JsxOpeningElement|JsxSelfClosingElement) { - write('<'); + write("<"); emit(node.tagName); if (node.attributes.length > 0 || (node.kind === SyntaxKind.JsxSelfClosingElement)) { - write(' '); + write(" "); } emitAttributes(node.attributes); if (node.kind === SyntaxKind.JsxSelfClosingElement) { - write('/>'); + write("/>"); } else { - write('>'); + write(">"); } } function emitJsxClosingElement(node: JsxClosingElement) { - write(''); + write(">"); } function emitJsxElement(node: JsxElement) {