Skip to content

Commit

Permalink
Merge pull request facebook#220 from stevelacy/lint
Browse files Browse the repository at this point in the history
Lint code - change double quotes to single in website/jsdocs
  • Loading branch information
a2 committed Mar 26, 2015
2 parents 324f96b + 5a4e780 commit 821dcb5
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
36 changes: 18 additions & 18 deletions website/jsdocs/TypeExpressionParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

/*global exports:true*/
"use strict";
'use strict';

var Syntax = require('esprima-fb').Syntax;

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -486,18 +486,18 @@ 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);
}

// 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;
}

Expand All @@ -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],
Expand Down
4 changes: 2 additions & 2 deletions website/jsdocs/findExportDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

/*jslint node: true */
"use strict";
'use strict';

var esprima = require('esprima-fb');
var Syntax = esprima.Syntax;
Expand Down Expand Up @@ -278,6 +278,6 @@ function findExportDefinition(ast) {
}

return null;
};
}

module.exports = findExportDefinition;
4 changes: 2 additions & 2 deletions website/jsdocs/generic-function-visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/*global exports:true*/
/*jslint node:true*/
"use strict";
'use strict';

var util = require('util');

Expand Down Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions website/jsdocs/jsdocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

/*jslint node: true */
"use strict";
'use strict';

var esprima = require('esprima-fb');
var fs = require('fs');
Expand All @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
});
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion website/jsdocs/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/*global exports:true*/
/*jslint node:true*/
"use strict";
'use strict';

var util = require('util');

Expand Down
2 changes: 1 addition & 1 deletion website/jsdocs/traverseFlat.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/*global exports:true*/
/*jslint node:true*/
"use strict";
'use strict';

var Syntax = require('esprima-fb').Syntax;

Expand Down
2 changes: 1 addition & 1 deletion website/jsdocs/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

/*global exports:true*/
"use strict";
'use strict';

var util = require('util');

Expand Down

0 comments on commit 821dcb5

Please sign in to comment.