mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-27 14:19:59 +08:00
Run eslint --fix
Summary: CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable. **Test plan** Quick manual test, cosmetic changes only. Closes https://github.com/facebook/react-native/pull/16229 Differential Revision: D6009748 Pulled By: TheSavior fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
This commit is contained in:
committed by
Facebook Github Bot
parent
32e5c8e5b5
commit
0cd69e8a02
@@ -227,7 +227,7 @@ function parseSegmentType(stream, pos) {
|
||||
var segmentAst;
|
||||
if (stream[pos].type == TOKENS.OPENSEGMENT &&
|
||||
(segmentAst = parseAnyType(stream, ++pos))) {
|
||||
pos += segmentAst.length
|
||||
pos += segmentAst.length;
|
||||
if (stream[pos].type == TOKENS.CLOSESEGMENT) {
|
||||
return createAst(SYMBOLS.SEGMENT, segmentAst, segmentAst.length + 2);
|
||||
}
|
||||
@@ -235,9 +235,9 @@ function parseSegmentType(stream, pos) {
|
||||
}
|
||||
|
||||
function parseAnyType(stream, pos, parsers) {
|
||||
if (!parsers) parsers =
|
||||
if (!parsers) {parsers =
|
||||
PARSERS.SEGMENT | PARSERS.SIMPLE | PARSERS.UNION | PARSERS.GENERIC
|
||||
| PARSERS.FUNCTION;
|
||||
| PARSERS.FUNCTION;}
|
||||
|
||||
var ast =
|
||||
(parsers & PARSERS.UNION && parseUnionType(stream, pos)) ||
|
||||
|
||||
@@ -71,7 +71,7 @@ function isAssignmentStatement(node) {
|
||||
*/
|
||||
function expressionToArray(expr) {
|
||||
var parts = [];
|
||||
switch(expr.type) {
|
||||
switch (expr.type) {
|
||||
case Syntax.CallExpression:
|
||||
parts = expressionToArray(expr.callee);
|
||||
break;
|
||||
|
||||
@@ -48,7 +48,7 @@ function getTypeHintsFromDocBlock(node, docBlocksByLine) {
|
||||
}, {});
|
||||
|
||||
var param;
|
||||
while(param = paramRe.exec(comments.value)) {
|
||||
while (param = paramRe.exec(comments.value)) {
|
||||
|
||||
if (!param[1]) {
|
||||
continue;
|
||||
@@ -80,7 +80,7 @@ function getTypeHintsFromDocBlock(node, docBlocksByLine) {
|
||||
var returnType = returnRe.exec(comments.value);
|
||||
if (returnType && returnType[1]) {
|
||||
throw new Error(util.format('Lines: %s-%s: Your @return declaration in' +
|
||||
' function %s is incorrectly written as @returns. Remove the trailing'+
|
||||
' function %s is incorrectly written as @returns. Remove the trailing' +
|
||||
' \'s\'.',
|
||||
comments.loc.start.line, comments.loc.end.line, functionName));
|
||||
}
|
||||
@@ -107,7 +107,7 @@ function getTypeHintFromInline(node, commentsByLine) {
|
||||
*/
|
||||
function parseComments(programNode, state) {
|
||||
programNode.comments.forEach(function(c) {
|
||||
if (c.type !== 'Block') return;
|
||||
if (c.type !== 'Block') {return;}
|
||||
|
||||
var comments;
|
||||
if (c.loc.start.line === c.loc.end.line &&
|
||||
@@ -156,8 +156,8 @@ function normalizeTypeHintParams(node, state, typeHints) {
|
||||
if (typeHint[1]) {
|
||||
preCond.push([
|
||||
typeHint[0],
|
||||
'\''+ type.parseAndNormalize(typeHint[1], typeHint[0], node) +'\'',
|
||||
'\''+ typeHint[0] +'\''
|
||||
'\'' + type.parseAndNormalize(typeHint[1], typeHint[0], node) + '\'',
|
||||
'\'' + typeHint[0] + '\''
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ function getFileDocBlock(commentsForFile) {
|
||||
var lines = comment.value.split('\n');
|
||||
var inCopyrightBlock = false;
|
||||
var filteredLines = lines.filter(function(line) {
|
||||
if (!!line.match(/^\s*\*\s+Copyright \(c\)/)) {
|
||||
if (line.match(/^\s*\*\s+Copyright \(c\)/)) {
|
||||
inCopyrightBlock = true;
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ function getRequireData(node) {
|
||||
|| (callee.name !== 'require')) {
|
||||
return null;
|
||||
}
|
||||
var args = node['arguments'];
|
||||
var args = node.arguments;
|
||||
if (args.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user