Lint code - change double quotes to single in website/jsdocs. Add/remove semicolons to keep code style

This commit is contained in:
Steve Lacy 2015-03-26 11:14:54 -07:00
parent 937dec72f6
commit 5a4e780ac3
7 changed files with 32 additions and 32 deletions

View File

@ -8,7 +8,7 @@
*/ */
/*global exports:true*/ /*global exports:true*/
"use strict"; 'use strict';
var Syntax = require('esprima-fb').Syntax; var Syntax = require('esprima-fb').Syntax;
@ -25,7 +25,7 @@ function reverseObject(/*object*/ object) /*object*/ {
var reversed = {}; var reversed = {};
for (var key in object) { for (var key in object) {
if (object.hasOwnProperty(key)) { if (object.hasOwnProperty(key)) {
reversed[object[key]] = key reversed[object[key]] = key;
} }
} }
return reversed; return reversed;
@ -452,16 +452,16 @@ exports.popTypeVariables = popTypeVariables;
function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ { function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ {
var ast; var ast;
switch (annotation.type) { switch (annotation.type) {
case "NumberTypeAnnotation": case 'NumberTypeAnnotation':
return createAst(SYMBOLS.SIMPLE, "number", 0); return createAst(SYMBOLS.SIMPLE, 'number', 0);
case "StringTypeAnnotation": case 'StringTypeAnnotation':
return createAst(SYMBOLS.SIMPLE, "string", 0); return createAst(SYMBOLS.SIMPLE, 'string', 0);
case "BooleanTypeAnnotation": case 'BooleanTypeAnnotation':
return createAst(SYMBOLS.SIMPLE, "boolean", 0); return createAst(SYMBOLS.SIMPLE, 'boolean', 0);
case "AnyTypeAnnotation": // fallthrough case 'AnyTypeAnnotation': // fallthrough
case "VoidTypeAnnotation": case 'VoidTypeAnnotation':
return null; return null;
case "NullableTypeAnnotation": case 'NullableTypeAnnotation':
ast = fromFlowAnnotation(annotation.typeAnnotation, state); ast = fromFlowAnnotation(annotation.typeAnnotation, state);
if (ast) { if (ast) {
ast.nullable = true; ast.nullable = true;
@ -486,10 +486,10 @@ function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ {
// to render a simple function instead of a detailed one // to render a simple function instead of a detailed one
if ((params.length || returnType) if ((params.length || returnType)
&& params.length === annotation.params.length) { && 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); return createAst(SYMBOLS.SIMPLE, 'function', 0);
case "GenericTypeAnnotation": case 'GenericTypeAnnotation':
var alias = getTypeAlias(annotation.id, state); var alias = getTypeAlias(annotation.id, state);
if (alias) { if (alias) {
return fromFlowAnnotation(alias, state); return fromFlowAnnotation(alias, state);
@ -497,7 +497,7 @@ function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ {
// Qualified type identifiers are not handled by runtime typechecker, // Qualified type identifiers are not handled by runtime typechecker,
// so simply omit the annotation for now. // so simply omit the annotation for now.
if (annotation.id.type === "QualifiedTypeIdentifier") { if (annotation.id.type === 'QualifiedTypeIdentifier') {
return null; return null;
} }
@ -521,12 +521,12 @@ function fromFlowAnnotation(/*object*/ annotation, state) /*?object*/ {
); );
switch (name) { switch (name) {
case "mixed": // fallthrough case 'mixed': // fallthrough
case "$Enum": case '$Enum':
// Not supported // Not supported
return null; return null;
case "array": // fallthrough case 'array': // fallthrough
case "promise": case 'promise':
if (annotation.typeParameters) { if (annotation.typeParameters) {
var parametricAst = fromFlowAnnotation( var parametricAst = fromFlowAnnotation(
annotation.typeParameters.params[0], annotation.typeParameters.params[0],

View File

@ -8,7 +8,7 @@
*/ */
/*jslint node: true */ /*jslint node: true */
"use strict"; 'use strict';
var esprima = require('esprima-fb'); var esprima = require('esprima-fb');
var Syntax = esprima.Syntax; var Syntax = esprima.Syntax;
@ -278,6 +278,6 @@ function findExportDefinition(ast) {
} }
return null; return null;
}; }
module.exports = findExportDefinition; module.exports = findExportDefinition;

View File

@ -9,7 +9,7 @@
/*global exports:true*/ /*global exports:true*/
/*jslint node:true*/ /*jslint node:true*/
"use strict"; 'use strict';
var util = require('util'); var util = require('util');
@ -278,7 +278,7 @@ function renderParams(/*?object*/ params) /*string*/ {
var returnParam = '\"returns\":' + '\'' + params.returns + '\''; var returnParam = '\"returns\":' + '\'' + params.returns + '\'';
formattedParams.push(returnParam); formattedParams.push(returnParam);
} }
return "{" + formattedParams.join(',') + "}"; return '{' + formattedParams.join(',') + '}';
} }
function getModuleName(state) { function getModuleName(state) {

View File

@ -8,7 +8,7 @@
*/ */
/*jslint node: true */ /*jslint node: true */
"use strict"; 'use strict';
var esprima = require('esprima-fb'); var esprima = require('esprima-fb');
var fs = require('fs'); var fs = require('fs');
@ -17,7 +17,7 @@ var Syntax = esprima.Syntax;
var findExportDefinition = require('./findExportDefinition'); var findExportDefinition = require('./findExportDefinition');
var genericTransform = require('./generic-function-visitor'); var genericTransform = require('./generic-function-visitor');
var genericVisitor = genericTransform.visitorList[0]; var genericVisitor = genericTransform.visitorList[0];
var traverseFlat = require('./traverseFlat') var traverseFlat = require('./traverseFlat');
var parseTypehint = require('./TypeExpressionParser').parse; var parseTypehint = require('./TypeExpressionParser').parse;
// Don't save object properties source code that is longer than this // Don't save object properties source code that is longer than this
@ -76,7 +76,7 @@ function stripStaticUpstreamWarning(docblock) {
return docblock; return docblock;
} }
// Esprima strips out the starting and ending tokens, so add them back // Esprima strips out the starting and ending tokens, so add them back
docblock = "/*" + docblock + "*/\n"; docblock = '/*' + docblock + '*/\n';
return docblock; return docblock;
} }
@ -104,13 +104,13 @@ function getFileDocBlock(commentsForFile) {
var docblock; var docblock;
commentsForFile.some(function(comment, i) { commentsForFile.some(function(comment, i) {
if (comment.loc.start.line === 1) { 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 filteredLines = lines.filter(function(line) {
var hasCopyright = !!line.match(/^\s*\*\s+Copyright/); var hasCopyright = !!line.match(/^\s*\*\s+Copyright/);
var hasProvides = !!line.match(/^\s*\*\s+@provides/); var hasProvides = !!line.match(/^\s*\*\s+@provides/);
return !hasCopyright && !hasProvides; return !hasCopyright && !hasProvides;
}); });
docblock = filteredLines.join("\n"); docblock = filteredLines.join('\n');
return true; return true;
} }
}); });
@ -149,7 +149,7 @@ function getDocBlock(node, commentsForFile, linesForFile) {
var lineComment = commentsForFile[ii]; var lineComment = commentsForFile[ii];
if (lineComment.loc.end.line === line) { if (lineComment.loc.end.line === line) {
docblock = '//' + lineComment.value + docblock = '//' + lineComment.value +
(docblock ? "\n" + docblock : ""); (docblock ? '\n' + docblock : '');
line--; line--;
} else { } else {
break; break;
@ -463,7 +463,7 @@ function getRequireData(node) {
* @return {?object} data * @return {?object} data
*/ */
function parseSource(source) { function parseSource(source) {
var lines = source.split("\n"); var lines = source.split('\n');
var ast = esprima.parse(source, { var ast = esprima.parse(source, {
loc: true, loc: true,
comment: true, comment: true,

View File

@ -9,7 +9,7 @@
/*global exports:true*/ /*global exports:true*/
/*jslint node:true*/ /*jslint node:true*/
"use strict"; 'use strict';
var util = require('util'); var util = require('util');

View File

@ -9,7 +9,7 @@
/*global exports:true*/ /*global exports:true*/
/*jslint node:true*/ /*jslint node:true*/
"use strict"; 'use strict';
var Syntax = require('esprima-fb').Syntax; var Syntax = require('esprima-fb').Syntax;

View File

@ -8,7 +8,7 @@
*/ */
/*global exports:true*/ /*global exports:true*/
"use strict"; 'use strict';
var util = require('util'); var util = require('util');