From 5a4e780ac3e8cb765f5d8abc098443eddb8be475 Mon Sep 17 00:00:00 2001 From: Steve Lacy Date: Thu, 26 Mar 2015 11:14:54 -0700 Subject: [PATCH] Lint code - change double quotes to single in website/jsdocs. Add/remove semicolons to keep code style --- website/jsdocs/TypeExpressionParser.js | 36 +++++++++++----------- website/jsdocs/findExportDefinition.js | 4 +-- website/jsdocs/generic-function-visitor.js | 4 +-- website/jsdocs/jsdocs.js | 14 ++++----- website/jsdocs/meta.js | 2 +- website/jsdocs/traverseFlat.js | 2 +- website/jsdocs/type.js | 2 +- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/website/jsdocs/TypeExpressionParser.js b/website/jsdocs/TypeExpressionParser.js index 43b3b9f00..2ded51ede 100644 --- a/website/jsdocs/TypeExpressionParser.js +++ b/website/jsdocs/TypeExpressionParser.js @@ -8,7 +8,7 @@ */ /*global exports:true*/ -"use strict"; +'use strict'; var Syntax = require('esprima-fb').Syntax; @@ -25,7 +25,7 @@ function reverseObject(/*object*/ object) /*object*/ { var reversed = {}; for (var key in object) { if (object.hasOwnProperty(key)) { - reversed[object[key]] = key + reversed[object[key]] = key; } } return reversed; @@ -452,16 +452,16 @@ exports.popTypeVariables = popTypeVariables; function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ { var ast; switch (annotation.type) { - case "NumberTypeAnnotation": - return createAst(SYMBOLS.SIMPLE, "number", 0); - case "StringTypeAnnotation": - return createAst(SYMBOLS.SIMPLE, "string", 0); - case "BooleanTypeAnnotation": - return createAst(SYMBOLS.SIMPLE, "boolean", 0); - case "AnyTypeAnnotation": // fallthrough - case "VoidTypeAnnotation": + case 'NumberTypeAnnotation': + return createAst(SYMBOLS.SIMPLE, 'number', 0); + case 'StringTypeAnnotation': + return createAst(SYMBOLS.SIMPLE, 'string', 0); + case 'BooleanTypeAnnotation': + return createAst(SYMBOLS.SIMPLE, 'boolean', 0); + case 'AnyTypeAnnotation': // fallthrough + case 'VoidTypeAnnotation': return null; - case "NullableTypeAnnotation": + case 'NullableTypeAnnotation': ast = fromFlowAnnotation(annotation.typeAnnotation, state); if (ast) { ast.nullable = true; @@ -486,10 +486,10 @@ function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ { // to render a simple function instead of a detailed one if ((params.length || returnType) && params.length === annotation.params.length) { - return createAst(SYMBOLS.FUNCTION, [params, returnType], 0) + return createAst(SYMBOLS.FUNCTION, [params, returnType], 0); } return createAst(SYMBOLS.SIMPLE, 'function', 0); - case "GenericTypeAnnotation": + case 'GenericTypeAnnotation': var alias = getTypeAlias(annotation.id, state); if (alias) { return fromFlowAnnotation(alias, state); @@ -497,7 +497,7 @@ function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ { // Qualified type identifiers are not handled by runtime typechecker, // so simply omit the annotation for now. - if (annotation.id.type === "QualifiedTypeIdentifier") { + if (annotation.id.type === 'QualifiedTypeIdentifier') { return null; } @@ -521,12 +521,12 @@ function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ { ); switch (name) { - case "mixed": // fallthrough - case "$Enum": + case 'mixed': // fallthrough + case '$Enum': // Not supported return null; - case "array": // fallthrough - case "promise": + case 'array': // fallthrough + case 'promise': if (annotation.typeParameters) { var parametricAst = fromFlowAnnotation( annotation.typeParameters.params[0], diff --git a/website/jsdocs/findExportDefinition.js b/website/jsdocs/findExportDefinition.js index 72a0cbe7d..4a6f6a0fe 100644 --- a/website/jsdocs/findExportDefinition.js +++ b/website/jsdocs/findExportDefinition.js @@ -8,7 +8,7 @@ */ /*jslint node: true */ -"use strict"; +'use strict'; var esprima = require('esprima-fb'); var Syntax = esprima.Syntax; @@ -278,6 +278,6 @@ function findExportDefinition(ast) { } return null; -}; +} module.exports = findExportDefinition; diff --git a/website/jsdocs/generic-function-visitor.js b/website/jsdocs/generic-function-visitor.js index 0cb98ba86..e9719c3c1 100644 --- a/website/jsdocs/generic-function-visitor.js +++ b/website/jsdocs/generic-function-visitor.js @@ -9,7 +9,7 @@ /*global exports:true*/ /*jslint node:true*/ -"use strict"; +'use strict'; var util = require('util'); @@ -278,7 +278,7 @@ function renderParams(/*?object*/ params) /*string*/ { var returnParam = '\"returns\":' + '\'' + params.returns + '\''; formattedParams.push(returnParam); } - return "{" + formattedParams.join(',') + "}"; + return '{' + formattedParams.join(',') + '}'; } function getModuleName(state) { diff --git a/website/jsdocs/jsdocs.js b/website/jsdocs/jsdocs.js index 67f49238a..3f7cb953e 100644 --- a/website/jsdocs/jsdocs.js +++ b/website/jsdocs/jsdocs.js @@ -8,7 +8,7 @@ */ /*jslint node: true */ -"use strict"; +'use strict'; var esprima = require('esprima-fb'); var fs = require('fs'); @@ -17,7 +17,7 @@ var Syntax = esprima.Syntax; var findExportDefinition = require('./findExportDefinition'); var genericTransform = require('./generic-function-visitor'); var genericVisitor = genericTransform.visitorList[0]; -var traverseFlat = require('./traverseFlat') +var traverseFlat = require('./traverseFlat'); var parseTypehint = require('./TypeExpressionParser').parse; // Don't save object properties source code that is longer than this @@ -76,7 +76,7 @@ function stripStaticUpstreamWarning(docblock) { return docblock; } // Esprima strips out the starting and ending tokens, so add them back - docblock = "/*" + docblock + "*/\n"; + docblock = '/*' + docblock + '*/\n'; return docblock; } @@ -104,13 +104,13 @@ function getFileDocBlock(commentsForFile) { var docblock; commentsForFile.some(function(comment, i) { if (comment.loc.start.line === 1) { - var lines = comment.value.split("\n"); + var lines = comment.value.split('\n'); var filteredLines = lines.filter(function(line) { var hasCopyright = !!line.match(/^\s*\*\s+Copyright/); var hasProvides = !!line.match(/^\s*\*\s+@provides/); return !hasCopyright && !hasProvides; }); - docblock = filteredLines.join("\n"); + docblock = filteredLines.join('\n'); return true; } }); @@ -149,7 +149,7 @@ function getDocBlock(node, commentsForFile, linesForFile) { var lineComment = commentsForFile[ii]; if (lineComment.loc.end.line === line) { docblock = '//' + lineComment.value + - (docblock ? "\n" + docblock : ""); + (docblock ? '\n' + docblock : ''); line--; } else { break; @@ -463,7 +463,7 @@ function getRequireData(node) { * @return {?object} data */ function parseSource(source) { - var lines = source.split("\n"); + var lines = source.split('\n'); var ast = esprima.parse(source, { loc: true, comment: true, diff --git a/website/jsdocs/meta.js b/website/jsdocs/meta.js index 399b29778..d61c5aaf1 100644 --- a/website/jsdocs/meta.js +++ b/website/jsdocs/meta.js @@ -9,7 +9,7 @@ /*global exports:true*/ /*jslint node:true*/ -"use strict"; +'use strict'; var util = require('util'); diff --git a/website/jsdocs/traverseFlat.js b/website/jsdocs/traverseFlat.js index 8baa1b2e7..5f9ff14fb 100644 --- a/website/jsdocs/traverseFlat.js +++ b/website/jsdocs/traverseFlat.js @@ -9,7 +9,7 @@ /*global exports:true*/ /*jslint node:true*/ -"use strict"; +'use strict'; var Syntax = require('esprima-fb').Syntax; diff --git a/website/jsdocs/type.js b/website/jsdocs/type.js index 612a1349d..0ea74eb0c 100644 --- a/website/jsdocs/type.js +++ b/website/jsdocs/type.js @@ -8,7 +8,7 @@ */ /*global exports:true*/ -"use strict"; +'use strict'; var util = require('util');