Fixing eslint-comments warnings

Reviewed By: yungsters

Differential Revision: D6678252

fbshipit-source-id: ee93b7ee52520b750ca11fcc625cccf3cd82d075
This commit is contained in:
Eli White 2018-01-08 16:54:56 -08:00 committed by Facebook Github Bot
parent a1a0a69546
commit 11a495cb32
19 changed files with 83 additions and 70 deletions

View File

@ -20,7 +20,6 @@
* --package - com.facebook.react.tests
* --retries [num] - how many times to retry possible flaky commands: npm install and running tests, default 1
*/
/*eslint-disable no-undef */
const argv = require('yargs').argv;
const async = require('async');

View File

@ -5,100 +5,132 @@
* @copyright 2014-2015 Gaetan Renaudeau. MIT License.
* @noflow
* @emails oncall+react_native
* @format
*/
/* eslint-disable */
'use strict';
var bezier = require('bezier');
var identity = function (x) { return x; };
var identity = function(x) {
return x;
};
function assertClose (a, b, precision = 3) {
function assertClose(a, b, precision = 3) {
expect(a).toBeCloseTo(b, precision);
}
function makeAssertCloseWithPrecision (precision) {
return function (a, b) {
function makeAssertCloseWithPrecision(precision) {
return function(a, b) {
assertClose(a, b, precision);
};
}
function allEquals (be1, be2, samples, assertion) {
if (!assertion) assertion = assertClose;
for (var i=0; i<=samples; ++i) {
function allEquals(be1, be2, samples, assertion) {
if (!assertion) {
assertion = assertClose;
}
for (var i = 0; i <= samples; ++i) {
var x = i / samples;
assertion(be1(x), be2(x));
}
}
function repeat (n) {
return function (f) {
for (var i=0; i<n; ++i) f(i);
function repeat(n) {
return function(f) {
for (var i = 0; i < n; ++i) {
f(i);
}
};
}
describe('bezier', function(){
it('should be a function', function(){
describe('bezier', function() {
it('should be a function', function() {
expect(typeof bezier === 'function').toBe(true);
});
it('should creates an object', function(){
it('should creates an object', function() {
expect(typeof bezier(0, 0, 1, 1) === 'function').toBe(true);
});
it('should fail with wrong arguments', function () {
expect(function () { bezier(0.5, 0.5, -5, 0.5); }).toThrow();
expect(function () { bezier(0.5, 0.5, 5, 0.5); }).toThrow();
expect(function () { bezier(-2, 0.5, 0.5, 0.5); }).toThrow();
expect(function () { bezier(2, 0.5, 0.5, 0.5); }).toThrow();
it('should fail with wrong arguments', function() {
expect(function() {
bezier(0.5, 0.5, -5, 0.5);
}).toThrow();
expect(function() {
bezier(0.5, 0.5, 5, 0.5);
}).toThrow();
expect(function() {
bezier(-2, 0.5, 0.5, 0.5);
}).toThrow();
expect(function() {
bezier(2, 0.5, 0.5, 0.5);
}).toThrow();
});
describe('linear curves', function () {
it('should be linear', function () {
describe('linear curves', function() {
it('should be linear', function() {
allEquals(bezier(0, 0, 1, 1), bezier(1, 1, 0, 0), 100);
allEquals(bezier(0, 0, 1, 1), identity, 100);
});
});
describe('common properties', function () {
it('should be the right value at extremes', function () {
repeat(10)(function () {
var a = Math.random(), b = 2*Math.random()-0.5, c = Math.random(), d = 2*Math.random()-0.5;
describe('common properties', function() {
it('should be the right value at extremes', function() {
repeat(10)(function() {
var a = Math.random(),
b = 2 * Math.random() - 0.5,
c = Math.random(),
d = 2 * Math.random() - 0.5;
var easing = bezier(a, b, c, d);
expect(easing(0)).toBe(0);
expect(easing(1)).toBe(1);
});
});
it('should approach the projected value of its x=y projected curve', function () {
repeat(10)(function () {
var a = Math.random(), b = Math.random(), c = Math.random(), d = Math.random();
it('should approach the projected value of its x=y projected curve', function() {
repeat(10)(function() {
var a = Math.random(),
b = Math.random(),
c = Math.random(),
d = Math.random();
var easing = bezier(a, b, c, d);
var projected = bezier(b, a, d, c);
var composed = function (x) { return projected(easing(x)); };
var composed = function(x) {
return projected(easing(x));
};
allEquals(identity, composed, 100, makeAssertCloseWithPrecision(2));
});
});
});
describe('two same instances', function () {
it('should be strictly equals', function () {
repeat(10)(function () {
var a = Math.random(), b = 2*Math.random()-0.5, c = Math.random(), d = 2*Math.random()-0.5;
describe('two same instances', function() {
it('should be strictly equals', function() {
repeat(10)(function() {
var a = Math.random(),
b = 2 * Math.random() - 0.5,
c = Math.random(),
d = 2 * Math.random() - 0.5;
allEquals(bezier(a, b, c, d), bezier(a, b, c, d), 100, 0);
});
});
});
describe('symetric curves', function () {
it('should have a central value y~=0.5 at x=0.5', function () {
repeat(10)(function () {
var a = Math.random(), b = 2*Math.random()-0.5, c = 1-a, d = 1-b;
describe('symetric curves', function() {
it('should have a central value y~=0.5 at x=0.5', function() {
repeat(10)(function() {
var a = Math.random(),
b = 2 * Math.random() - 0.5,
c = 1 - a,
d = 1 - b;
var easing = bezier(a, b, c, d);
assertClose(easing(0.5), 0.5, 2);
});
});
it('should be symetrical', function () {
repeat(10)(function () {
var a = Math.random(), b = 2*Math.random()-0.5, c = 1-a, d = 1-b;
it('should be symetrical', function() {
repeat(10)(function() {
var a = Math.random(),
b = 2 * Math.random() - 0.5,
c = 1 - a,
d = 1 - b;
var easing = bezier(a, b, c, d);
var sym = function (x) { return 1 - easing(1-x); };
var sym = function(x) {
return 1 - easing(1 - x);
};
allEquals(easing, sym, 100, makeAssertCloseWithPrecision(2));
});
});

View File

@ -611,7 +611,7 @@ const ScrollView = createReactClass({
_handleScroll: function(e: Object) {
if (__DEV__) {
if (this.props.onScroll && this.props.scrollEventThrottle == null && Platform.OS === 'ios') {
console.log( // eslint-disable-line no-console
console.log(
'You specified `onScroll` on a <ScrollView> but not ' +
'`scrollEventThrottle`. You will only receive one event. ' +
'Using `16` you get all the events but be aware that it may ' +

View File

@ -10,7 +10,6 @@
* @flow
*/
/* eslint-disable strict */
/* globals window: true */
/**
@ -115,9 +114,7 @@ if (!global.__fbDisableExceptionsManager) {
try {
ExceptionsManager.handleException(e, isFatal);
} catch (ee) {
/* eslint-disable no-console */
console.log('Failed to print error: ', ee.message);
/* eslint-enable no-console */
throw e;
}
};

View File

@ -10,8 +10,6 @@
* @flow
*/
/* eslint-disable dot-notation, no-dimensions-get-window */
'use strict';
const Dimensions = require('Dimensions');

View File

@ -11,8 +11,6 @@
* @format
*/
/* eslint-disable no-console */
'use strict';
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error

View File

@ -10,7 +10,7 @@
*
*/
/* eslint-disable */
/* globals Headers, Request, Response */
'use strict';

View File

@ -14,7 +14,7 @@
* Intentional info-level logging for clear separation from ad-hoc console debug logging.
*/
function infoLog(...args) {
return console.log(...args); // eslint-disable-line no-console
return console.log(...args);
}
module.exports = infoLog;

View File

@ -11,7 +11,7 @@
* @nolint
*/
/* eslint-disable */
/* eslint-disable consistent-this */
/**
* Creates an array from array like objects.

View File

@ -11,7 +11,7 @@
* @nolint
*/
/* eslint-disable */
/* eslint-disable no-bitwise, no-extend-native, radix, no-self-compare */
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
function findIndex(predicate, context) {

View File

@ -11,8 +11,6 @@
* @nolint
*/
/* eslint-disable strict */
if (Number.EPSILON === undefined) {
Object.defineProperty(Number, 'EPSILON', {
value: Math.pow(2, -52),
@ -29,7 +27,6 @@ if (Number.MIN_SAFE_INTEGER === undefined) {
});
}
if (!Number.isNaN) {
// eslint-disable-next-line max-len
// https://github.com/dherman/tc39-codex-wiki/blob/master/data/es6/number/index.md#polyfill-for-numberisnan
const globalIsNaN = global.isNaN;
Object.defineProperty(Number, 'isNaN', {

View File

@ -11,8 +11,6 @@
* @nolint
*/
/* eslint-disable strict */
// WARNING: This is an optimized version that fails on hasOwnProperty checks
// and non objects. It's not spec-compliant. It's a perf optimization.
// This is only needed for iOS 8 and current Android JSC.

View File

@ -11,7 +11,7 @@
* @nolint
*/
/* eslint-disable strict, no-extend-native, no-bitwise */
/* eslint-disable no-extend-native, no-bitwise */
/*
* NOTE: We use (Number(x) || 0) to replace NaN values with zero.

View File

@ -9,8 +9,6 @@
* @emails oncall+jsinfra
*/
/* eslint-disable fb-www/object-create-only-one-param */
'use strict';
describe('Object (ES7)', () => {

View File

@ -11,7 +11,7 @@
* @nolint
*/
/* eslint-disable */
/* eslint-disable quotes, curly, no-proto, no-undef-init, dot-notation */
// Created by running:
// require('babel-core').buildExternalHelpers('_extends classCallCheck createClass createRawReactElement defineProperty get inherits interopRequireDefault interopRequireWildcard objectWithoutProperties possibleConstructorReturn slicedToArray taggedTemplateLiteral toArray toConsumableArray '.split(' '))

View File

@ -12,7 +12,7 @@
* @format
*/
/* eslint-disable */
/* eslint-disable no-shadow, eqeqeq, curly, no-unused-vars, no-void */
/**
* This pipes all of our console logging functions to native logging so that

View File

@ -11,8 +11,6 @@
* @nolint
*/
/* eslint-disable strict */
let _inGuard = 0;
/**

View File

@ -256,7 +256,7 @@ class MessagingTest extends React.Component<{}, $FlowFixMeState> {
class InjectJS extends React.Component<{}> {
webview = null;
injectJS = () => {
const script = 'document.write("Injected JS ")'; // eslint-disable-line quotes
const script = 'document.write("Injected JS ")';
if (this.webview) {
this.webview.injectJavaScript(script);
}

View File

@ -13,8 +13,6 @@
'use strict';
/* eslint-disable no-unclear-flowtypes */
declare var jest: any;
declare var describe: any;
declare var beforeEach: any;