diff --git a/Libraries/BatchedBridge/MessageQueue.js b/Libraries/BatchedBridge/MessageQueue.js index e3871bddf273d0..0b593ef203ea3e 100644 --- a/Libraries/BatchedBridge/MessageQueue.js +++ b/Libraries/BatchedBridge/MessageQueue.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @flow strict - * @noformat + * @format */ 'use strict'; @@ -72,19 +72,17 @@ class MessageQueue { } // $FlowFixMe[cannot-write] - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - this.callFunctionReturnFlushedQueue = this.callFunctionReturnFlushedQueue.bind( - this, - ); + this.callFunctionReturnFlushedQueue = + // $FlowFixMe[method-unbinding] added when improving typing for this parameters + this.callFunctionReturnFlushedQueue.bind(this); // $FlowFixMe[cannot-write] // $FlowFixMe[method-unbinding] added when improving typing for this parameters this.flushedQueue = this.flushedQueue.bind(this); // $FlowFixMe[cannot-write] - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - this.invokeCallbackAndReturnFlushedQueue = this.invokeCallbackAndReturnFlushedQueue.bind( - this, - ); + this.invokeCallbackAndReturnFlushedQueue = + // $FlowFixMe[method-unbinding] added when improving typing for this parameters + this.invokeCallbackAndReturnFlushedQueue.bind(this); } /** diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index ec3f3c9cd58c79..eb3db6f488df56 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @flow strict-local - * @noformat + * @format */ const React = require('react'); @@ -100,7 +100,8 @@ const ProgressBarAndroid = ( const ProgressBarAndroidToExport = React.forwardRef(ProgressBarAndroid); -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -module.exports = (ProgressBarAndroidToExport: typeof ProgressBarAndroidNativeComponent); +module.exports = + /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an + * error found when Flow v0.89 was deployed. To see the error, delete this + * comment and run Flow. */ + (ProgressBarAndroidToExport: typeof ProgressBarAndroidNativeComponent); diff --git a/Libraries/Utilities/ReactNativeTestTools.js b/Libraries/Utilities/ReactNativeTestTools.js index 8c8f6b70ffc856..f947eebb0891b6 100644 --- a/Libraries/Utilities/ReactNativeTestTools.js +++ b/Libraries/Utilities/ReactNativeTestTools.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @flow - * @noformat + * @format */ /* eslint-env jest */ @@ -26,13 +26,14 @@ export type ReactTestInstance = $PropertyType; export type Predicate = (node: ReactTestInstance) => boolean; type $ReturnType = $Call<((...A) => Ret) => Ret, Fn>; -/* $FlowFixMe[prop-missing] (>=0.125.1 site=react_native_fb) This comment - * suppresses an error found when Flow v0.125.1 was deployed. To see the error, - * delete this comment and run Flow. */ /* $FlowFixMe[value-as-type] (>=0.125.1 site=react_native_fb) This comment * suppresses an error found when Flow v0.125.1 was deployed. To see the error, * delete this comment and run Flow. */ -export type ReactTestRendererJSON = $ReturnType; +export type ReactTestRendererJSON = + /* $FlowFixMe[prop-missing] (>=0.125.1 site=react_native_fb) This comment + * suppresses an error found when Flow v0.125.1 was deployed. To see the error, + * delete this comment and run Flow. */ + $ReturnType; const { Switch, @@ -199,10 +200,8 @@ function tap(instance: ReactTestInstance) { } else if ( touchable?.props?.onStartShouldSetResponder?.testOnly_pressabilityConfig ) { - const { - onPress, - disabled, - } = touchable.props.onStartShouldSetResponder.testOnly_pressabilityConfig(); + const {onPress, disabled} = + touchable.props.onStartShouldSetResponder.testOnly_pressabilityConfig(); if (!disabled) { onPress({nativeEvent: {}}); } diff --git a/packages/polyfills/Object.es8.js b/packages/polyfills/Object.es8.js index 20e2d3d03d8733..80bfb16623f05d 100644 --- a/packages/polyfills/Object.es8.js +++ b/packages/polyfills/Object.es8.js @@ -4,12 +4,12 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @noformat + * @format * @polyfill * @nolint */ -(function() { +(function () { 'use strict'; const hasOwnProperty = Object.prototype.hasOwnProperty; @@ -19,7 +19,7 @@ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries */ if (typeof Object.entries !== 'function') { - Object.entries = function(object) { + Object.entries = function (object) { // `null` and `undefined` values are not allowed. if (object == null) { throw new TypeError('Object.entries called on non-object'); @@ -40,7 +40,7 @@ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values */ if (typeof Object.values !== 'function') { - Object.values = function(object) { + Object.values = function (object) { // `null` and `undefined` values are not allowed. if (object == null) { throw new TypeError('Object.values called on non-object'); diff --git a/packages/polyfills/console.js b/packages/polyfills/console.js index fee5ddb392dca6..c2a2ed26dded22 100644 --- a/packages/polyfills/console.js +++ b/packages/polyfills/console.js @@ -6,7 +6,7 @@ * * @polyfill * @nolint - * @noformat + * @format */ /* eslint-disable no-shadow, eqeqeq, curly, no-unused-vars, no-void, no-control-regex */ @@ -15,7 +15,7 @@ * This pipes all of our console logging functions to native logging so that * JavaScript errors in required modules show up in Xcode via NSLog. */ -const inspect = (function() { +const inspect = (function () { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -55,7 +55,7 @@ const inspect = (function() { function arrayToHash(array) { var hash = {}; - array.forEach(function(val, idx) { + array.forEach(function (val, idx) { hash[val] = true; }); @@ -153,7 +153,7 @@ const inspect = (function() { if (array) { output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); } else { - output = keys.map(function(key) { + output = keys.map(function (key) { return formatProperty( ctx, value, @@ -210,7 +210,7 @@ const inspect = (function() { output.push(''); } } - keys.forEach(function(key) { + keys.forEach(function (key) { if (!key.match(/^\d+$/)) { output.push( formatProperty(ctx, value, recurseTimes, visibleKeys, key, true), @@ -248,7 +248,7 @@ const inspect = (function() { if (array) { str = str .split('\n') - .map(function(line) { + .map(function (line) { return ' ' + line; }) .join('\n') @@ -258,7 +258,7 @@ const inspect = (function() { '\n' + str .split('\n') - .map(function(line) { + .map(function (line) { return ' ' + line; }) .join('\n'); @@ -290,7 +290,7 @@ const inspect = (function() { function reduceToSingleString(output, base, braces) { var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { + var length = output.reduce(function (prev, cur) { numLinesEst++; if (cur.indexOf('\n') >= 0) numLinesEst++; return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; @@ -396,13 +396,13 @@ INSPECTOR_LEVELS[LOG_LEVELS.error] = 'error'; const INSPECTOR_FRAMES_TO_SKIP = __DEV__ ? 2 : 1; function getNativeLogFunction(level) { - return function() { + return function () { let str; if (arguments.length === 1 && typeof arguments[0] === 'string') { str = arguments[0]; } else { str = Array.prototype.map - .call(arguments, function(arg) { + .call(arguments, function (arg) { return inspect(arg, {depth: 10}); }) .join(', '); @@ -443,7 +443,7 @@ function getNativeLogFunction(level) { } function repeat(element, n) { - return Array.apply(null, Array(n)).map(function() { + return Array.apply(null, Array(n)).map(function () { return element; }); } @@ -472,7 +472,7 @@ function consoleTablePolyfill(rows) { // Convert each cell to a string. Also // figure out max cell width for each column - columns.forEach(function(k, i) { + columns.forEach(function (k, i) { columnWidths[i] = k.length; for (var j = 0; j < rows.length; j++) { var cellStr = (rows[j][k] || '?').toString(); @@ -485,7 +485,7 @@ function consoleTablePolyfill(rows) { // Join all elements in the row into a single string with | separators // (appends extra spaces to each cell to make separators | aligned) function joinRow(row, space) { - var cells = row.map(function(cell, i) { + var cells = row.map(function (cell, i) { var extraSpaces = repeat(' ', columnWidths[i] - cell.length).join(''); return cell + extraSpaces; }); @@ -493,7 +493,7 @@ function consoleTablePolyfill(rows) { return cells.join(space + '|' + space); } - var separators = columnWidths.map(function(columnWidth) { + var separators = columnWidths.map(function (columnWidth) { return repeat('-', columnWidth).join(''); }); var separatorRow = joinRow(separators, '-'); @@ -579,7 +579,7 @@ if (global.nativeLoggingHook) { Object.keys(console).forEach(methodName => { const reactNativeMethod = console[methodName]; if (originalConsole[methodName]) { - console[methodName] = function() { + console[methodName] = function () { originalConsole[methodName](...arguments); reactNativeMethod.apply(console, arguments); }; @@ -591,7 +591,7 @@ if (global.nativeLoggingHook) { // supported by it. ['clear', 'dir', 'dirxml', 'profile', 'profileEnd'].forEach(methodName => { if (typeof originalConsole[methodName] === 'function') { - console[methodName] = function() { + console[methodName] = function () { originalConsole[methodName](...arguments); }; } diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index 3c1cdeb89cd10c..14c4be208220ce 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @flow strict - * @noformat + * @format */ 'use strict'; @@ -100,10 +100,8 @@ function translateFunctionParamToJavaType( imports: Set, ): string { const {optional, typeAnnotation: nullableTypeAnnotation} = param; - const [ - typeAnnotation, - nullable, - ] = unwrapNullable(nullableTypeAnnotation); + const [typeAnnotation, nullable] = + unwrapNullable(nullableTypeAnnotation); const isRequired = !optional && !nullable; function wrapIntoNullableIfNeeded(generatedType: string) { @@ -169,12 +167,10 @@ function translateFunctionReturnTypeToJavaType( resolveAlias: AliasResolver, imports: Set, ): string { - const [ - returnTypeAnnotation, - nullable, - ] = unwrapNullable( - nullableReturnTypeAnnotation, - ); + const [returnTypeAnnotation, nullable] = + unwrapNullable( + nullableReturnTypeAnnotation, + ); function wrapIntoNullableIfNeeded(generatedType: string) { if (nullable) { @@ -234,12 +230,10 @@ function getFalsyReturnStatementFromReturnType( createErrorMessage: (typeName: string) => string, resolveAlias: AliasResolver, ): string { - const [ - returnTypeAnnotation, - nullable, - ] = unwrapNullable( - nullableReturnTypeAnnotation, - ); + const [returnTypeAnnotation, nullable] = + unwrapNullable( + nullableReturnTypeAnnotation, + ); let realTypeAnnotation = returnTypeAnnotation; if (realTypeAnnotation.type === 'TypeAliasTypeAnnotation') { @@ -288,9 +282,8 @@ function buildGetConstantsMethod( method: NativeModulePropertyShape, imports: Set, ): string { - const [ - methodTypeAnnotation, - ] = unwrapNullable(method.typeAnnotation); + const [methodTypeAnnotation] = + unwrapNullable(method.typeAnnotation); if ( methodTypeAnnotation.returnTypeAnnotation.type === 'ObjectTypeAnnotation' ) { @@ -405,11 +398,10 @@ module.exports = { return buildGetConstantsMethod(method, imports); } - const [ - methodTypeAnnotation, - ] = unwrapNullable( - method.typeAnnotation, - ); + const [methodTypeAnnotation] = + unwrapNullable( + method.typeAnnotation, + ); // Handle return type const translatedReturnType = translateFunctionReturnTypeToJavaType(