mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 13:25:51 +08:00
Auto-fix lint errors
Reviewed By: bestander Differential Revision: D3683952 fbshipit-source-id: 9484d0b0e86859e8edaca0da1aa13a667f200905
This commit is contained in:
committed by
Facebook Github Bot 4
parent
8e2906ae89
commit
94666f16c7
@@ -18,9 +18,9 @@ var DialogModuleAndroid = require('NativeModules').DialogManagerAndroid;
|
||||
import type { AlertType, AlertButtonStyle } from 'AlertIOS';
|
||||
|
||||
type Buttons = Array<{
|
||||
text?: string;
|
||||
onPress?: ?Function;
|
||||
style?: AlertButtonStyle;
|
||||
text?: string,
|
||||
onPress?: ?Function,
|
||||
style?: AlertButtonStyle,
|
||||
}>;
|
||||
|
||||
type Options = {
|
||||
@@ -113,13 +113,13 @@ class AlertAndroid {
|
||||
var buttonNegative = validButtons.pop();
|
||||
var buttonNeutral = validButtons.pop();
|
||||
if (buttonNeutral) {
|
||||
config = {...config, buttonNeutral: buttonNeutral.text || '' }
|
||||
config = {...config, buttonNeutral: buttonNeutral.text || '' };
|
||||
}
|
||||
if (buttonNegative) {
|
||||
config = {...config, buttonNegative: buttonNegative.text || '' }
|
||||
config = {...config, buttonNegative: buttonNegative.text || '' };
|
||||
}
|
||||
if (buttonPositive) {
|
||||
config = {...config, buttonPositive: buttonPositive.text || '' }
|
||||
config = {...config, buttonPositive: buttonPositive.text || '' };
|
||||
}
|
||||
DialogModuleAndroid.showAlert(
|
||||
config,
|
||||
|
||||
@@ -21,19 +21,19 @@ export type AlertType = $Enum<{
|
||||
/**
|
||||
* Default alert with no inputs
|
||||
*/
|
||||
'default': string;
|
||||
'default': string,
|
||||
/**
|
||||
* Plain text input alert
|
||||
*/
|
||||
'plain-text': string;
|
||||
'plain-text': string,
|
||||
/**
|
||||
* Secure text input alert
|
||||
*/
|
||||
'secure-text': string;
|
||||
'secure-text': string,
|
||||
/**
|
||||
* Login and password alert
|
||||
*/
|
||||
'login-password': string;
|
||||
'login-password': string,
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -43,15 +43,15 @@ export type AlertButtonStyle = $Enum<{
|
||||
/**
|
||||
* Default button style
|
||||
*/
|
||||
'default': string;
|
||||
'default': string,
|
||||
/**
|
||||
* Cancel button style
|
||||
*/
|
||||
'cancel': string;
|
||||
'cancel': string,
|
||||
/**
|
||||
* Destructive button style
|
||||
*/
|
||||
'destructive': string;
|
||||
'destructive': string,
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -65,15 +65,15 @@ type ButtonsArray = Array<{
|
||||
/**
|
||||
* Button label
|
||||
*/
|
||||
text?: string;
|
||||
text?: string,
|
||||
/**
|
||||
* Callback function when button pressed
|
||||
*/
|
||||
onPress?: ?Function;
|
||||
onPress?: ?Function,
|
||||
/**
|
||||
* Button style
|
||||
*/
|
||||
style?: AlertButtonStyle;
|
||||
style?: AlertButtonStyle,
|
||||
}>;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||
var DEVICE_BACK_EVENT = 'hardwareBackPress';
|
||||
|
||||
type BackPressEventName = $Enum<{
|
||||
backPress: string;
|
||||
backPress: string,
|
||||
}>;
|
||||
|
||||
var _backPressSubscriptions = new Set();
|
||||
@@ -30,7 +30,7 @@ RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function() {
|
||||
if (subscriptions[i]()) {
|
||||
invokeDefault = false;
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (invokeDefault) {
|
||||
|
||||
@@ -109,13 +109,13 @@ Error: ${e.message}`
|
||||
: eval;
|
||||
|
||||
code = [
|
||||
`__accept(`,
|
||||
'__accept(',
|
||||
`${id},`,
|
||||
`function(global,require,module,exports){`,
|
||||
'function(global,require,module,exports){',
|
||||
`${code}`,
|
||||
'\n},',
|
||||
`${JSON.stringify(inverseDependencies)}`,
|
||||
`);`,
|
||||
');',
|
||||
].join('');
|
||||
|
||||
injectFunction(code, sourceURLs[i]);
|
||||
|
||||
@@ -96,9 +96,9 @@ class MessageQueue {
|
||||
if (spyOrToggle === true){
|
||||
MessageQueue.prototype.__spy = (info)=>{
|
||||
console.log(`${info.type == TO_JS ? 'N->JS' : 'JS->N'} : ` +
|
||||
`${info.module ? (info.module+'.') : ''}${info.method}` +
|
||||
`${info.module ? (info.module + '.') : ''}${info.method}` +
|
||||
`(${JSON.stringify(info.args)})`);
|
||||
}
|
||||
};
|
||||
} else if (spyOrToggle === false) {
|
||||
MessageQueue.prototype.__spy = null;
|
||||
} else {
|
||||
|
||||
@@ -18,8 +18,8 @@ var invariant = require('fbjs/lib/invariant');
|
||||
var performanceNow = require('fbjs/lib/performanceNow');
|
||||
|
||||
type perfModule = {
|
||||
start: () => void;
|
||||
stop: () => void;
|
||||
start: () => void,
|
||||
stop: () => void,
|
||||
}
|
||||
|
||||
var perfModules = [];
|
||||
|
||||
@@ -10,29 +10,29 @@
|
||||
*/
|
||||
'use strict';
|
||||
var remoteModulesConfig = {
|
||||
"RemoteModule1": {
|
||||
"moduleID":0,
|
||||
"methods":{
|
||||
"remoteMethod1":{
|
||||
"type":"remote",
|
||||
"methodID":0
|
||||
'RemoteModule1': {
|
||||
'moduleID':0,
|
||||
'methods':{
|
||||
'remoteMethod1':{
|
||||
'type':'remote',
|
||||
'methodID':0
|
||||
},
|
||||
"remoteMethod2":{
|
||||
"type":"remote",
|
||||
"methodID":1
|
||||
'remoteMethod2':{
|
||||
'type':'remote',
|
||||
'methodID':1
|
||||
}
|
||||
}
|
||||
},
|
||||
"RemoteModule2":{
|
||||
"moduleID":1,
|
||||
"methods":{
|
||||
"remoteMethod1":{
|
||||
"type":"remote",
|
||||
"methodID":0
|
||||
'RemoteModule2':{
|
||||
'moduleID':1,
|
||||
'methods':{
|
||||
'remoteMethod1':{
|
||||
'type':'remote',
|
||||
'methodID':0
|
||||
},
|
||||
"remoteMethod2":{
|
||||
"type":"remote",
|
||||
"methodID":1
|
||||
'remoteMethod2':{
|
||||
'type':'remote',
|
||||
'methodID':1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,29 +42,29 @@ var remoteModulesConfig = {
|
||||
* These actually exist in the __tests__ folder.
|
||||
*/
|
||||
var localModulesConfig = {
|
||||
"MessageQueueTestModule1": {
|
||||
"moduleID":"MessageQueueTestModule1",
|
||||
"methods":{
|
||||
"testHook1":{
|
||||
"type":"local",
|
||||
"methodID":"testHook1"
|
||||
'MessageQueueTestModule1': {
|
||||
'moduleID':'MessageQueueTestModule1',
|
||||
'methods':{
|
||||
'testHook1':{
|
||||
'type':'local',
|
||||
'methodID':'testHook1'
|
||||
},
|
||||
"testHook2":{
|
||||
"type":"local",
|
||||
"methodID":"testHook2"
|
||||
'testHook2':{
|
||||
'type':'local',
|
||||
'methodID':'testHook2'
|
||||
}
|
||||
}
|
||||
},
|
||||
"MessageQueueTestModule2": {
|
||||
"moduleID":"MessageQueueTestModule2",
|
||||
"methods": {
|
||||
"runLocalCode":{
|
||||
"type":"local",
|
||||
"methodID":"runLocalCode"
|
||||
'MessageQueueTestModule2': {
|
||||
'moduleID':'MessageQueueTestModule2',
|
||||
'methods': {
|
||||
'runLocalCode':{
|
||||
'type':'local',
|
||||
'methodID':'runLocalCode'
|
||||
},
|
||||
"runLocalCode2":{
|
||||
"type":"local",
|
||||
"methodID":"runLocalCode2"
|
||||
'runLocalCode2':{
|
||||
'type':'local',
|
||||
'methodID':'runLocalCode2'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('MessageQueue', function() {
|
||||
|
||||
it('should enqueue native calls', () => {
|
||||
queue.__nativeCall(0, 1, [2]);
|
||||
let flushedQueue = queue.flushedQueue();
|
||||
const flushedQueue = queue.flushedQueue();
|
||||
assertQueue(flushedQueue, 0, 0, 1, [2]);
|
||||
});
|
||||
|
||||
@@ -77,13 +77,13 @@ describe('MessageQueue', function() {
|
||||
|
||||
it('should generate native modules', () => {
|
||||
queue.RemoteModules.RemoteModule1.remoteMethod1('foo');
|
||||
let flushedQueue = queue.flushedQueue();
|
||||
const flushedQueue = queue.flushedQueue();
|
||||
assertQueue(flushedQueue, 0, 0, 0, ['foo']);
|
||||
});
|
||||
|
||||
it('should store callbacks', () => {
|
||||
queue.RemoteModules.RemoteModule1.remoteMethod2('foo', () => {}, () => {});
|
||||
let flushedQueue = queue.flushedQueue();
|
||||
const flushedQueue = queue.flushedQueue();
|
||||
assertQueue(flushedQueue, 0, 0, 1, ['foo', 0, 1]);
|
||||
});
|
||||
|
||||
@@ -111,8 +111,8 @@ describe('MessageQueue', function() {
|
||||
|
||||
// First we're going to call into this (overriden) test hook pretending to
|
||||
// be a remote module making a "local" invocation into JS.
|
||||
let onFail = jasmine.createSpy();
|
||||
let onSucc = jasmine.createSpy();
|
||||
const onFail = jasmine.createSpy();
|
||||
const onSucc = jasmine.createSpy();
|
||||
MessageQueueTestModule1.testHook1 = function() {
|
||||
// Then inside of this local module, we're going to fire off a remote
|
||||
// request.
|
||||
@@ -173,7 +173,7 @@ describe('MessageQueue', function() {
|
||||
var secondSuccCBID = resultingRemoteInvocations[2][1][3];
|
||||
|
||||
// Trigger init
|
||||
queue.RemoteModules
|
||||
queue.RemoteModules;
|
||||
// Handle the first remote invocation by signaling failure.
|
||||
// -------------------------------------------------------
|
||||
queue.__invokeCallback(firstFailCBID, ['firstFailure']);
|
||||
|
||||
@@ -14,7 +14,7 @@ jest.unmock('groupByEveryN');
|
||||
describe('groupByEveryN', () => {
|
||||
var groupByEveryN = require('groupByEveryN');
|
||||
|
||||
it ('should group by with different n', () => {
|
||||
it('should group by with different n', () => {
|
||||
expect(groupByEveryN([1, 2, 3, 4, 5, 6, 7, 8, 9], 1))
|
||||
.toEqual([[1], [2], [3], [4], [5], [6], [7], [8], [9]]);
|
||||
expect(groupByEveryN([1, 2, 3, 4, 5, 6, 7, 8, 9], 2))
|
||||
@@ -25,7 +25,7 @@ describe('groupByEveryN', () => {
|
||||
.toEqual([[1, 2, 3, 4], [5, 6, 7, 8], [9, null, null, null]]);
|
||||
});
|
||||
|
||||
it ('should fill with null', () => {
|
||||
it('should fill with null', () => {
|
||||
expect(groupByEveryN([], 4))
|
||||
.toEqual([]);
|
||||
expect(groupByEveryN([1], 4))
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
jest.unmock('truncate');
|
||||
|
||||
@@ -15,37 +15,37 @@ describe('truncate', () => {
|
||||
|
||||
var truncate = require('truncate');
|
||||
|
||||
it ('should truncate', () => {
|
||||
it('should truncate', () => {
|
||||
expect(truncate('Hello, world.', 5))
|
||||
.toBe('He...');
|
||||
});
|
||||
it ('should not truncate', () => {
|
||||
it('should not truncate', () => {
|
||||
expect(truncate('Hello, world.', 50))
|
||||
.toBe('Hello, world.');
|
||||
});
|
||||
it ('should not truncate more than minDelta chars.', () => {
|
||||
it('should not truncate more than minDelta chars.', () => {
|
||||
expect(truncate('Hello, world.', 7, {minDelta: 10}))
|
||||
.toBe('Hello, world.');
|
||||
expect(truncate('Hello, world.', 7, {minDelta: 9}))
|
||||
.toBe('Hell...');
|
||||
});
|
||||
it ('should break in the middle of words', () => {
|
||||
it('should break in the middle of words', () => {
|
||||
expect(truncate('Hello, world. How are you?', 18, {breakOnWords: false}))
|
||||
.toBe('Hello, world. H...');
|
||||
expect(truncate('Hello, world.\nHow are you?', 18, {breakOnWords: false}))
|
||||
.toBe('Hello, world.\nHo...');
|
||||
});
|
||||
it ('should break at word boundaries', () => {
|
||||
it('should break at word boundaries', () => {
|
||||
expect(truncate('Hello, world. How are you?', 18, {breakOnWords: true}))
|
||||
.toBe('Hello, world....');
|
||||
expect(truncate('Hello, world.\nHow are you?', 18, {breakOnWords: true}))
|
||||
.toBe('Hello, world....');
|
||||
});
|
||||
it ('should uses custom elipses', () => {
|
||||
it('should uses custom elipses', () => {
|
||||
expect(truncate('Hello, world.', 9, {elipsis: '·'}))
|
||||
.toBe('He·');
|
||||
});
|
||||
it ('shouldn\'t barf with weird input', () => {
|
||||
it('shouldn\'t barf with weird input', () => {
|
||||
expect(truncate('Hello, world.', 0))
|
||||
.toBe('Hello,...');
|
||||
expect(truncate('Hello, world.', -132))
|
||||
|
||||
@@ -49,6 +49,6 @@ module.exports = function(promise: Promise<any>, callbacks: Array<Function>, typ
|
||||
err => callback(err)
|
||||
);
|
||||
default:
|
||||
throw new Error(`Type of callbacks not specified. Must be one of 'success-first', 'error-first', 'single-callback-value-first', or 'node'`);
|
||||
throw new Error('Type of callbacks not specified. Must be one of \'success-first\', \'error-first\', \'single-callback-value-first\', or \'node\'');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
'use strict';
|
||||
|
||||
type Inset = {
|
||||
top: ?number;
|
||||
left: ?number;
|
||||
right: ?number;
|
||||
bottom: ?number;
|
||||
top: ?number,
|
||||
left: ?number,
|
||||
right: ?number,
|
||||
bottom: ?number,
|
||||
}
|
||||
|
||||
var dummyInsets = {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
'use strict';
|
||||
|
||||
type Point = {
|
||||
x: ?number;
|
||||
y: ?number;
|
||||
x: ?number,
|
||||
y: ?number,
|
||||
}
|
||||
|
||||
var dummyPoint = {x: undefined, y: undefined};
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
'use strict';
|
||||
|
||||
type truncateOptions = {
|
||||
breakOnWords: boolean;
|
||||
minDelta: number;
|
||||
elipsis: string;
|
||||
breakOnWords: boolean,
|
||||
minDelta: number,
|
||||
elipsis: string,
|
||||
}
|
||||
|
||||
const defaultOptions = {
|
||||
|
||||
Reference in New Issue
Block a user