Upgrade Prettier in Xplat to version 1.19.1

Summary:
Upgrades Prettier in Xplat to 1.19.1
Ignores upgrading packages on already on versions greater than 1.19.1

Changelog: [Internal]

allow-large-files
bypass-lint

(Note: this ignores all push blocking failures!)

Reviewed By: gkz, cpojer

Differential Revision: D20879147

fbshipit-source-id: 0deee7ac941e91e1c3c3a1e7d3d3ed20de1d657d
This commit is contained in:
George Zahariev authored and Facebook GitHub Bot committed 2020-04-09 11:01:58 -07:00
1 parent cd13c99d00
commit cd347a7e0e
35 files changed
+150 -171

No files matched your search

+4 -1
View File
@@ -152,7 +152,10 @@ function testMerge() {
}
function testOptimizedMultiGet() {
let batch = [[KEY_1, VAL_1], [KEY_2, VAL_2]];
let batch = [
[KEY_1, VAL_1],
[KEY_2, VAL_2],
];
let keys = batch.map(([key, value]) => key);
AsyncStorage.multiSet(batch, err1 => {
// yes, twice on purpose
@@ -235,9 +235,7 @@ function validateTransform(
configs.forEach(config => {
if (!TRANSFORM_WHITELIST.hasOwnProperty(config.property)) {
throw new Error(
`Property '${
config.property
}' is not supported by native animated module`,
`Property '${config.property}' is not supported by native animated module`,
);
}
});
@@ -357,11 +357,19 @@ describe('Native Animated', () => {
expect(additionConnectionCalls.length).toBe(2);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
additionCall[1].input[0],
{type: 'value', value: 1, offset: 0},
{
type: 'value',
value: 1,
offset: 0,
},
);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
additionCall[1].input[1],
{type: 'value', value: 2, offset: 0},
{
type: 'value',
value: 2,
offset: 0,
},
);
});
@@ -391,11 +399,19 @@ describe('Native Animated', () => {
expect(subtractionConnectionCalls.length).toBe(2);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
subtractionCall[1].input[0],
{type: 'value', value: 2, offset: 0},
{
type: 'value',
value: 2,
offset: 0,
},
);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
subtractionCall[1].input[1],
{type: 'value', value: 1, offset: 0},
{
type: 'value',
value: 1,
offset: 0,
},
);
});
@@ -425,11 +441,19 @@ describe('Native Animated', () => {
expect(multiplicationConnectionCalls.length).toBe(2);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
multiplicationCall[1].input[0],
{type: 'value', value: 2, offset: 0},
{
type: 'value',
value: 2,
offset: 0,
},
);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
multiplicationCall[1].input[1],
{type: 'value', value: 1, offset: 0},
{
type: 'value',
value: 1,
offset: 0,
},
);
});
@@ -459,11 +483,19 @@ describe('Native Animated', () => {
expect(divisionConnectionCalls.length).toBe(2);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
divisionCall[1].input[0],
{type: 'value', value: 4, offset: 0},
{
type: 'value',
value: 4,
offset: 0,
},
);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
divisionCall[1].input[1],
{type: 'value', value: 2, offset: 0},
{
type: 'value',
value: 2,
offset: 0,
},
);
});
@@ -491,7 +523,11 @@ describe('Native Animated', () => {
expect(moduloConnectionCalls.length).toBe(1);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
moduloCall[1].input,
{type: 'value', value: 4, offset: 0},
{
type: 'value',
value: 4,
offset: 0,
},
);
});
@@ -588,7 +624,11 @@ describe('Native Animated', () => {
expect(diffClampConnectionCalls.length).toBe(1);
expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith(
diffClampCall[1].input,
{type: 'value', value: 2, offset: 0},
{
type: 'value',
value: 2,
offset: 0,
},
);
});
@@ -81,13 +81,25 @@ describe('MessageQueue', function() {
});
it('should throw when calling the same callback twice', () => {
queue.enqueueNativeCall(0, 1, [], () => {}, () => {});
queue.enqueueNativeCall(
0,
1,
[],
() => {},
() => {},
);
queue.__invokeCallback(1, []);
expect(() => queue.__invokeCallback(1, [])).toThrow();
});
it('should throw when calling both success and failure callback', () => {
queue.enqueueNativeCall(0, 1, [], () => {}, () => {});
queue.enqueueNativeCall(
0,
1,
[],
() => {},
() => {},
);
queue.__invokeCallback(1, []);
expect(() => queue.__invokeCallback(0, [])).toThrow();
});
+1 -3
View File
@@ -119,9 +119,7 @@ export class URL {
if (BLOB_URL_PREFIX === null) {
throw new Error('Cannot create URL for blob!');
}
return `${BLOB_URL_PREFIX}${blob.data.blobId}?offset=${
blob.data.offset
}&size=${blob.size}`;
return `${BLOB_URL_PREFIX}${blob.data.blobId}?offset=${blob.data.offset}&size=${blob.size}`;
}
static revokeObjectURL(url: string) {
@@ -101,10 +101,7 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => {
return (
<View
onLayout={onLayout}
style={StyleSheet.compose(
styles.container,
style,
)}>
style={StyleSheet.compose(styles.container, style)}>
{Platform.OS === 'android' ? (
// $FlowFixMe Flow doesn't know when this is the android component
<PlatformActivityIndicator {...nativeProps} {...androidProps} />
@@ -170,10 +170,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
return (
<View
ref={this.viewRef}
style={StyleSheet.compose(
style,
heightStyle,
)}
style={StyleSheet.compose(style, heightStyle)}
onLayout={this._onLayout}
{...props}>
{children}
@@ -188,12 +185,9 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
onLayout={this._onLayout}
{...props}>
<View
style={StyleSheet.compose(
contentContainerStyle,
{
bottom: bottomHeight,
},
)}>
style={StyleSheet.compose(contentContainerStyle, {
bottom: bottomHeight,
})}>
{children}
</View>
</View>
@@ -203,10 +197,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
return (
<View
ref={this.viewRef}
style={StyleSheet.compose(
style,
{paddingBottom: bottomHeight},
)}
style={StyleSheet.compose(style, {paddingBottom: bottomHeight})}
onLayout={this._onLayout}
{...props}>
{children}
@@ -121,10 +121,7 @@ function PickerAndroid(props: Props): React.Node {
prompt: props.prompt,
ref: pickerRef,
selected,
style: StyleSheet.compose(
styles.pickerAndroid,
props.style,
),
style: StyleSheet.compose(styles.pickerAndroid, props.style),
backgroundColor: props.backgroundColor,
testID: props.testID,
};
+1 -4
View File
@@ -198,10 +198,7 @@ const Slider = (
props: Props,
forwardedRef?: ?React.Ref<typeof SliderNativeComponent>,
) => {
const style = StyleSheet.compose(
styles.slider,
props.style,
);
const style = StyleSheet.compose(styles.slider, props.style);
const {
disabled = false,
+1 -3
View File
@@ -467,9 +467,7 @@ class StatusBar extends React.Component<Props> {
const processedColor = processColor(mergedProps.backgroundColor.value);
if (processedColor == null) {
console.warn(
`\`StatusBar._updatePropsStack\`: Color ${
mergedProps.backgroundColor.value
} parsed to null or undefined`,
`\`StatusBar._updatePropsStack\`: Color ${mergedProps.backgroundColor.value} parsed to null or undefined`,
);
} else {
invariant(
+1 -3
View File
@@ -172,9 +172,7 @@ class TaskQueue {
this.hasTasksToProcess() && this._onMoreTasks();
})
.catch(ex => {
ex.message = `TaskQueue: Error resolving Promise in task ${
task.name
}: ${ex.message}`;
ex.message = `TaskQueue: Error resolving Promise in task ${task.name}: ${ex.message}`;
throw ex;
})
.done();
+1 -5
View File
@@ -593,11 +593,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
'Expected array of items with numColumns > 1',
);
return (
<View
style={StyleSheet.compose(
styles.row,
columnWrapperStyle,
)}>
<View style={StyleSheet.compose(styles.row, columnWrapperStyle)}>
{item.map((it, kk) => {
const element = renderer({
item: it,
+1 -4
View File
@@ -1117,10 +1117,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
element.props.onLayout(event);
}
},
style: StyleSheet.compose(
inversionStyle,
element.props.style,
),
style: StyleSheet.compose(inversionStyle, element.props.style),
}),
);
}
@@ -429,7 +429,10 @@ describe('onUpdate', function() {
expect(onViewableItemsChanged.mock.calls.length).toBe(2);
expect(onViewableItemsChanged.mock.calls[1][0]).toEqual({
changed: [{isViewable: true, key: 'c'}, {isViewable: false, key: 'a'}],
changed: [
{isViewable: true, key: 'c'},
{isViewable: false, key: 'a'},
],
viewabilityConfig: {viewAreaCoveragePercentThreshold: 0},
viewableItems: [{isViewable: true, key: 'c'}],
});
@@ -19,7 +19,7 @@ jest.mock('../LogBoxSymbolication', () => {
});
function getLogBoxLog() {
return new (require('../LogBoxLog')).default({
return new (require('../LogBoxLog').default)({
level: 'warn',
isComponentError: false,
message: {content: '...', substitutions: []},
+1 -3
View File
@@ -190,9 +190,7 @@ class Modal extends React.Component<Props> {
props.transparent
) {
console.warn(
`Modal with '${
props.presentationStyle
}' presentation style and 'transparent' value is not supported.`,
`Modal with '${props.presentationStyle}' presentation style and 'transparent' value is not supported.`,
);
}
}
@@ -18,53 +18,29 @@ const textStyle = {color: 'rgb(0, 0, 0)'};
module.exports = {
testGoodCompose() {
(StyleSheet.compose(
imageStyle,
imageStyle,
): ImageStyleProp);
(StyleSheet.compose(imageStyle, imageStyle): ImageStyleProp);
(StyleSheet.compose(
textStyle,
textStyle,
): TextStyleProp);
(StyleSheet.compose(textStyle, textStyle): TextStyleProp);
(StyleSheet.compose(
null,
null,
): TextStyleProp);
(StyleSheet.compose(null, null): TextStyleProp);
(StyleSheet.compose(
textStyle,
null,
): TextStyleProp);
(StyleSheet.compose(textStyle, null): TextStyleProp);
(StyleSheet.compose(
textStyle,
Math.random() < 0.5 ? textStyle : null,
): TextStyleProp);
(StyleSheet.compose(
[textStyle],
null,
): TextStyleProp);
(StyleSheet.compose([textStyle], null): TextStyleProp);
(StyleSheet.compose(
[textStyle],
null,
): TextStyleProp);
(StyleSheet.compose([textStyle], null): TextStyleProp);
(StyleSheet.compose(
[textStyle],
[textStyle],
): TextStyleProp);
(StyleSheet.compose([textStyle], [textStyle]): TextStyleProp);
},
testBadCompose() {
// $FlowExpectedError - Incompatible type.
(StyleSheet.compose(
textStyle,
textStyle,
): ImageStyleProp);
(StyleSheet.compose(textStyle, textStyle): ImageStyleProp);
// $FlowExpectedError - Incompatible type.
(StyleSheet.compose(
@@ -129,13 +129,23 @@ describe('deepDiffer', function() {
).toBe(false);
});
it('should consider all functions equal', () => {
expect(deepDiffer(() => {}, x => x)).toBe(false);
expect(
deepDiffer(
() => {},
x => x,
),
).toBe(false);
const f = () => {};
expect(deepDiffer(f, f)).toBe(false);
});
it('should compare functions if unsafelyIgnoreFunctions is false', () => {
expect(
deepDiffer(() => {}, x => x, undefined, {unsafelyIgnoreFunctions: false}),
deepDiffer(
() => {},
x => x,
undefined,
{unsafelyIgnoreFunctions: false},
),
).toBe(true);
const f = () => {};
expect(deepDiffer(f, f, undefined, {unsafelyIgnoreFunctions: false})).toBe(
@@ -143,9 +153,13 @@ describe('deepDiffer', function() {
);
// shorthand, omitting maxDepth
expect(deepDiffer(() => {}, x => x, {unsafelyIgnoreFunctions: false})).toBe(
true,
);
expect(
deepDiffer(
() => {},
x => x,
{unsafelyIgnoreFunctions: false},
),
).toBe(true);
expect(deepDiffer(f, f, {unsafelyIgnoreFunctions: false})).toBe(false);
});
it('should log when implicitly considering two different functions equal', () => {
@@ -48,7 +48,10 @@ describe('Object (ES7)', () => {
expect(Object.entries(foo)).toEqual([['x', 10]]);
const bar = {x: 10, y: 20};
expect(Object.entries(bar)).toEqual([['x', 10], ['y', 20]]);
expect(Object.entries(bar)).toEqual([
['x', 10],
['y', 20],
]);
});
it('should work with proto-less objects', () => {
@@ -73,7 +76,10 @@ describe('Object (ES7)', () => {
});
it('should convert to object primitive string', () => {
expect(Object.entries('ab')).toEqual([['0', 'a'], ['1', 'b']]);
expect(Object.entries('ab')).toEqual([
['0', 'a'],
['1', 'b'],
]);
});
});
+1 -3
View File
@@ -65,9 +65,7 @@ const inspect = (function() {
function formatValue(ctx, value, recurseTimes) {
ctx.formatValueCalls++;
if (ctx.formatValueCalls > 200) {
return `[TOO BIG formatValueCalls ${
ctx.formatValueCalls
} exceeded limit of 200]`;
return `[TOO BIG formatValueCalls ${ctx.formatValueCalls} exceeded limit of 200]`;
}
// Primitive types cannot have properties
@@ -112,13 +112,9 @@ class XHRExampleDownload extends React.Component<{...}, Object> {
return;
}
if (xhr.status === 200) {
let responseType = `Response is a string, ${
xhr.response.length
} characters long.`;
let responseType = `Response is a string, ${xhr.response.length} characters long.`;
if (xhr.response instanceof ArrayBuffer) {
responseType = `Response is an ArrayBuffer, ${
xhr.response.byteLength
} bytes long.`;
responseType = `Response is an ArrayBuffer, ${xhr.response.byteLength} bytes long.`;
}
Alert.alert('Download complete!', responseType);
} else if (xhr.status !== 0) {
+1 -1
View File
@@ -144,7 +144,7 @@
"jest-junit": "^6.3.0",
"jscodeshift": "^0.7.0",
"mkdirp": "^0.5.1",
"prettier": "1.17.0",
"prettier": "1.19.1",
"react": "16.13.1",
"react-test-renderer": "16.13.1",
"shelljs": "^0.7.8",
@@ -45,9 +45,7 @@ if (t1.length !== t2.length) {
for (let i = 0; i < t1.length; i++) {
if (t1[i] !== t2[i]) {
throw new Error(
`Old and new codegen does not produce similar output! ${i} ${
t1[i]
} | ${t2[i]}`,
`Old and new codegen does not produce similar output! ${i} ${t1[i]} | ${t2[i]}`,
);
}
}
@@ -49,9 +49,7 @@ function generatePropsString(componentName: string, component: ComponentShape) {
return component.props
.map(prop => {
const defaultValue = convertDefaultTypeToString(componentName, prop);
return `${prop.name}(convertRawProp(rawProps, "${
prop.name
}", sourceProps.${prop.name}, {${defaultValue}}))`;
return `${prop.name}(convertRawProp(rawProps, "${prop.name}", sourceProps.${prop.name}, {${defaultValue}}))`;
})
.join(',\n' + ' ');
}
@@ -275,9 +275,7 @@ function getNativeTypeFromAnnotation(
default:
(typeAnnotation: empty);
throw new Error(
`Received invalid typeAnnotation for ${componentName} prop ${
prop.name
}, received ${typeAnnotation.type}`,
`Received invalid typeAnnotation for ${componentName} prop ${prop.name}, received ${typeAnnotation.type}`,
);
}
}
@@ -727,9 +725,7 @@ function generateStruct(
default:
(property.typeAnnotation.type: empty);
throw new Error(
`Received invalid component property type ${
property.typeAnnotation.type
}`,
`Received invalid component property type ${property.typeAnnotation.type}`,
);
}
});
@@ -82,14 +82,10 @@ function getJavaValueForProp(
: `"${typeAnnotation.default}"`;
return `value == null ? ${defaultValueString} : (String) value`;
case 'Int32TypeAnnotation':
return `value == null ? ${
typeAnnotation.default
} : ((Double) value).intValue()`;
return `value == null ? ${typeAnnotation.default} : ((Double) value).intValue()`;
case 'DoubleTypeAnnotation':
if (prop.optional) {
return `value == null ? ${
typeAnnotation.default
}f : ((Double) value).doubleValue()`;
return `value == null ? ${typeAnnotation.default}f : ((Double) value).doubleValue()`;
} else {
return 'value == null ? Double.NaN : ((Double) value).doubleValue()';
}
@@ -97,9 +93,7 @@ function getJavaValueForProp(
if (typeAnnotation.default === null) {
return 'value == null ? null : ((Double) value).floatValue()';
} else if (prop.optional) {
return `value == null ? ${
typeAnnotation.default
}f : ((Double) value).floatValue()`;
return `value == null ? ${typeAnnotation.default}f : ((Double) value).floatValue()`;
} else {
return 'value == null ? Float.NaN : ((Double) value).floatValue()';
}
@@ -126,9 +120,7 @@ function getJavaValueForProp(
case 'StringEnumTypeAnnotation':
return '(String) value';
case 'Int32EnumTypeAnnotation':
return `value == null ? ${
typeAnnotation.default
} : ((Double) value).intValue()`;
return `value == null ? ${typeAnnotation.default} : ((Double) value).intValue()`;
default:
(typeAnnotation: empty);
throw new Error('Received invalid typeAnnotation');
@@ -78,9 +78,7 @@ function getReactDiffProcessValue(typeAnnotation) {
return j.literal(true);
default:
throw new Error(
`Received unknown array native typeAnnotation: "${
typeAnnotation.elementType.name
}"`,
`Received unknown array native typeAnnotation: "${typeAnnotation.elementType.name}"`,
);
}
}
@@ -110,9 +110,7 @@ module.exports = {
.map(param => {
const translatedParam = translatePrimitiveJSTypeToCpp(
param.typeAnnotation,
`Unspopported type for param "${param.name}" in ${
prop.name
}. Found: ${param.typeAnnotation.type}`,
`Unspopported type for param "${param.name}" in ${prop.name}. Found: ${param.typeAnnotation.type}`,
);
const isObject = translatedParam.startsWith('jsi::');
return (
@@ -128,9 +126,7 @@ module.exports = {
'::_RETURN_VALUE_::',
translatePrimitiveJSTypeToCpp(
prop.typeAnnotation.returnTypeAnnotation,
`Unspopported return type for ${prop.name}. Found: ${
prop.typeAnnotation.returnTypeAnnotation.type
}`,
`Unspopported return type for ${prop.name}. Found: ${prop.typeAnnotation.returnTypeAnnotation.type}`,
),
)
.replace(
@@ -201,9 +201,7 @@ module.exports = {
} else {
paramObjCType = translatePrimitiveJSTypeToObjCType(
param,
`Unspopported type for param "${param.name}" in ${
prop.name
}. Found: ${param.typeAnnotation.type}`,
`Unspopported type for param "${param.name}" in ${prop.name}. Found: ${param.typeAnnotation.type}`,
);
}
return `${i === 0 ? '' : param.name}:(${paramObjCType})${
@@ -232,9 +230,7 @@ module.exports = {
'::_RETURN_VALUE_::',
translatePrimitiveJSTypeToObjCTypeForReturn(
returnTypeAnnotation,
`Unspopported return type for ${prop.name}. Found: ${
prop.typeAnnotation.returnTypeAnnotation.type
}`,
`Unspopported return type for ${prop.name}. Found: ${prop.typeAnnotation.returnTypeAnnotation.type}`,
),
)
.replace('::_ARGS_::', nativeArgs);
@@ -66,9 +66,7 @@ function getInlineMethodSignature(
case 'AnyTypeAnnotation':
return `id<NSObject> ${property.name}() const;`;
case 'ArrayTypeAnnotation':
return `facebook::react::LazyVector<id<NSObject>> ${
property.name
}() const;`;
return `facebook::react::LazyVector<id<NSObject>> ${property.name}() const;`;
case 'FunctionTypeAnnotation':
default:
throw new Error(`Unknown prop type, found: ${typeAnnotation.type}"`);
@@ -127,9 +127,7 @@ function getCommandProperties(commandTypeName, types, commandOptions) {
if (typeAlias.type !== 'InterfaceDeclaration') {
throw new Error(
`The type argument for codegenNativeCommands must be an interface, received ${
typeAlias.type
}`,
`The type argument for codegenNativeCommands must be an interface, received ${typeAlias.type}`,
);
}
@@ -345,8 +345,8 @@ function buildPropSchema(property, types: TypeMap): ?PropTypeShape {
}
if (
value.type === 'NullableTypeAnnotation' &&
(typeAnnotation.type === 'GenericTypeAnnotation' &&
typeAnnotation.id.name === 'WithDefault')
typeAnnotation.type === 'GenericTypeAnnotation' &&
typeAnnotation.id.name === 'WithDefault'
) {
throw new Error(
'WithDefault<> is optional and does not need to be marked as optional. Please remove the ? annotation in front of it.',
@@ -406,9 +406,7 @@ function buildMethodSchema(
const value = getValueFromTypes(property.value, types);
if (value.type !== 'FunctionTypeAnnotation') {
throw new Error(
`Only methods are supported as module properties. Found ${
value.type
} in ${property.key.name}`,
`Only methods are supported as module properties. Found ${value.type} in ${property.key.name}`,
);
}
const params = value.params.map(param =>
@@ -56,9 +56,7 @@ testClasses.forEach(testClass => {
// any faster means Circle CI crashes
exec('sleep 10s');
return exec(
`./scripts/run-instrumentation-tests-via-adb-shell.sh ${
argv.package
} ${testClass}`,
`./scripts/run-instrumentation-tests-via-adb-shell.sh ${argv.package} ${testClass}`,
).code;
}, numberOfRetries)
) {
+4 -4
View File
@@ -6202,10 +6202,10 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
prettier@1.17.0:
version "1.17.0"
resolved "https://registry.npmjs.org/prettier/-/prettier-1.17.0.tgz#53b303676eed22cc14a9f0cec09b477b3026c008"
integrity sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw==
prettier@1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
pretty-format@^24.0.0:
version "24.0.0"