From 11a495cb3235ebbc2ad890e92ec612fd5316bffb Mon Sep 17 00:00:00 2001 From: Eli White Date: Mon, 8 Jan 2018 16:54:56 -0800 Subject: [PATCH] Fixing eslint-comments warnings Reviewed By: yungsters Differential Revision: D6678252 fbshipit-source-id: ee93b7ee52520b750ca11fcc625cccf3cd82d075 --- .../run-android-ci-instrumentation-tests.js | 1 - .../Animated/src/__tests__/bezier-test.js | 116 +++++++++++------- Libraries/Components/ScrollView/ScrollView.js | 2 +- Libraries/Core/InitializeCore.js | 3 - Libraries/Inspector/Inspector.js | 2 - Libraries/Lists/FillRateHelper.js | 2 - Libraries/Network/fetch.js | 2 +- Libraries/Utilities/infoLog.js | 2 +- Libraries/polyfills/Array.es6.js | 2 +- Libraries/polyfills/Array.prototype.es6.js | 2 +- Libraries/polyfills/Number.es6.js | 3 - Libraries/polyfills/Object.es6.js | 2 - Libraries/polyfills/String.prototype.es6.js | 2 +- .../polyfills/__tests__/Object.es7-test.js | 2 - Libraries/polyfills/babelHelpers.js | 2 +- Libraries/polyfills/console.js | 2 +- Libraries/polyfills/error-guard.js | 2 - RNTester/js/WebViewExample.js | 2 +- local-cli/__tests__/fs-mock-test.js | 2 - 19 files changed, 83 insertions(+), 70 deletions(-) diff --git a/ContainerShip/scripts/run-android-ci-instrumentation-tests.js b/ContainerShip/scripts/run-android-ci-instrumentation-tests.js index 00a9f4955..34ee3336a 100644 --- a/ContainerShip/scripts/run-android-ci-instrumentation-tests.js +++ b/ContainerShip/scripts/run-android-ci-instrumentation-tests.js @@ -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'); diff --git a/Libraries/Animated/src/__tests__/bezier-test.js b/Libraries/Animated/src/__tests__/bezier-test.js index a44b9be46..e34c4f799 100644 --- a/Libraries/Animated/src/__tests__/bezier-test.js +++ b/Libraries/Animated/src/__tests__/bezier-test.js @@ -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 but not ' + '`scrollEventThrottle`. You will only receive one event. ' + 'Using `16` you get all the events but be aware that it may ' + diff --git a/Libraries/Core/InitializeCore.js b/Libraries/Core/InitializeCore.js index 2e3821410..f0fc67235 100644 --- a/Libraries/Core/InitializeCore.js +++ b/Libraries/Core/InitializeCore.js @@ -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; } }; diff --git a/Libraries/Inspector/Inspector.js b/Libraries/Inspector/Inspector.js index 6cfe8c20e..8bfe2ef42 100644 --- a/Libraries/Inspector/Inspector.js +++ b/Libraries/Inspector/Inspector.js @@ -10,8 +10,6 @@ * @flow */ -/* eslint-disable dot-notation, no-dimensions-get-window */ - 'use strict'; const Dimensions = require('Dimensions'); diff --git a/Libraries/Lists/FillRateHelper.js b/Libraries/Lists/FillRateHelper.js index bc119a837..8d52111e1 100644 --- a/Libraries/Lists/FillRateHelper.js +++ b/Libraries/Lists/FillRateHelper.js @@ -11,8 +11,6 @@ * @format */ -/* eslint-disable no-console */ - 'use strict'; /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error diff --git a/Libraries/Network/fetch.js b/Libraries/Network/fetch.js index e64317136..d34d46987 100644 --- a/Libraries/Network/fetch.js +++ b/Libraries/Network/fetch.js @@ -10,7 +10,7 @@ * */ -/* eslint-disable */ + /* globals Headers, Request, Response */ 'use strict'; diff --git a/Libraries/Utilities/infoLog.js b/Libraries/Utilities/infoLog.js index 71fed5d2b..6a2a726a6 100644 --- a/Libraries/Utilities/infoLog.js +++ b/Libraries/Utilities/infoLog.js @@ -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; diff --git a/Libraries/polyfills/Array.es6.js b/Libraries/polyfills/Array.es6.js index 09153c868..e66212529 100644 --- a/Libraries/polyfills/Array.es6.js +++ b/Libraries/polyfills/Array.es6.js @@ -11,7 +11,7 @@ * @nolint */ -/* eslint-disable */ +/* eslint-disable consistent-this */ /** * Creates an array from array like objects. diff --git a/Libraries/polyfills/Array.prototype.es6.js b/Libraries/polyfills/Array.prototype.es6.js index 3d9e4a53e..67799deca 100644 --- a/Libraries/polyfills/Array.prototype.es6.js +++ b/Libraries/polyfills/Array.prototype.es6.js @@ -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) { diff --git a/Libraries/polyfills/Number.es6.js b/Libraries/polyfills/Number.es6.js index 78af739de..9323b2d3e 100644 --- a/Libraries/polyfills/Number.es6.js +++ b/Libraries/polyfills/Number.es6.js @@ -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', { diff --git a/Libraries/polyfills/Object.es6.js b/Libraries/polyfills/Object.es6.js index 5aa2abd57..a87a40311 100644 --- a/Libraries/polyfills/Object.es6.js +++ b/Libraries/polyfills/Object.es6.js @@ -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. diff --git a/Libraries/polyfills/String.prototype.es6.js b/Libraries/polyfills/String.prototype.es6.js index 195f5fd29..9d9b47c6b 100644 --- a/Libraries/polyfills/String.prototype.es6.js +++ b/Libraries/polyfills/String.prototype.es6.js @@ -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. diff --git a/Libraries/polyfills/__tests__/Object.es7-test.js b/Libraries/polyfills/__tests__/Object.es7-test.js index e820848d9..e8c4746c1 100644 --- a/Libraries/polyfills/__tests__/Object.es7-test.js +++ b/Libraries/polyfills/__tests__/Object.es7-test.js @@ -9,8 +9,6 @@ * @emails oncall+jsinfra */ -/* eslint-disable fb-www/object-create-only-one-param */ - 'use strict'; describe('Object (ES7)', () => { diff --git a/Libraries/polyfills/babelHelpers.js b/Libraries/polyfills/babelHelpers.js index e0c62d917..4965e5529 100644 --- a/Libraries/polyfills/babelHelpers.js +++ b/Libraries/polyfills/babelHelpers.js @@ -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(' ')) diff --git a/Libraries/polyfills/console.js b/Libraries/polyfills/console.js index d08f139a5..747b0521e 100644 --- a/Libraries/polyfills/console.js +++ b/Libraries/polyfills/console.js @@ -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 diff --git a/Libraries/polyfills/error-guard.js b/Libraries/polyfills/error-guard.js index fe660e242..24433346f 100644 --- a/Libraries/polyfills/error-guard.js +++ b/Libraries/polyfills/error-guard.js @@ -11,8 +11,6 @@ * @nolint */ -/* eslint-disable strict */ - let _inGuard = 0; /** diff --git a/RNTester/js/WebViewExample.js b/RNTester/js/WebViewExample.js index 8b45084da..d04600512 100644 --- a/RNTester/js/WebViewExample.js +++ b/RNTester/js/WebViewExample.js @@ -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); } diff --git a/local-cli/__tests__/fs-mock-test.js b/local-cli/__tests__/fs-mock-test.js index 175ebcacc..39f6e9e12 100644 --- a/local-cli/__tests__/fs-mock-test.js +++ b/local-cli/__tests__/fs-mock-test.js @@ -13,8 +13,6 @@ 'use strict'; -/* eslint-disable no-unclear-flowtypes */ - declare var jest: any; declare var describe: any; declare var beforeEach: any;