Skip to content

Commit

Permalink
Fixing eslint-comments warnings
Browse files Browse the repository at this point in the history
Reviewed By: yungsters

Differential Revision: D6678252

fbshipit-source-id: ee93b7ee52520b750ca11fcc625cccf3cd82d075
  • Loading branch information
elicwhite authored and facebook-github-bot committed Jan 9, 2018
1 parent a1a0a69 commit 11a495c
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
116 changes: 74 additions & 42 deletions Libraries/Animated/src/__tests__/bezier-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
});
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' +
Expand Down
3 changes: 0 additions & 3 deletions Libraries/Core/InitializeCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @flow
*/

/* eslint-disable strict */
/* globals window: true */

/**
Expand Down Expand Up @@ -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;
}
};
Expand Down
2 changes: 0 additions & 2 deletions Libraries/Inspector/Inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
* @flow
*/

/* eslint-disable dot-notation, no-dimensions-get-window */

'use strict';

const Dimensions = require('Dimensions');
Expand Down
2 changes: 0 additions & 2 deletions Libraries/Lists/FillRateHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* @format
*/

/* eslint-disable no-console */

'use strict';

/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Network/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
*/

/* eslint-disable */
/* globals Headers, Request, Response */

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Utilities/infoLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion Libraries/polyfills/Array.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @nolint
*/

/* eslint-disable */
/* eslint-disable consistent-this */

/**
* Creates an array from array like objects.
Expand Down
2 changes: 1 addition & 1 deletion Libraries/polyfills/Array.prototype.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions Libraries/polyfills/Number.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* @nolint
*/

/* eslint-disable strict */

if (Number.EPSILON === undefined) {
Object.defineProperty(Number, 'EPSILON', {
value: Math.pow(2, -52),
Expand All @@ -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', {
Expand Down
2 changes: 0 additions & 2 deletions Libraries/polyfills/Object.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Libraries/polyfills/String.prototype.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions Libraries/polyfills/__tests__/Object.es7-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* @emails oncall+jsinfra
*/

/* eslint-disable fb-www/object-create-only-one-param */

'use strict';

describe('Object (ES7)', () => {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/polyfills/babelHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(' '))
Expand Down
2 changes: 1 addition & 1 deletion Libraries/polyfills/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Libraries/polyfills/error-guard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* @nolint
*/

/* eslint-disable strict */

let _inGuard = 0;

/**
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/WebViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 0 additions & 2 deletions local-cli/__tests__/fs-mock-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

'use strict';

/* eslint-disable no-unclear-flowtypes */

declare var jest: any;
declare var describe: any;
declare var beforeEach: any;
Expand Down

0 comments on commit 11a495c

Please sign in to comment.