mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Upgrade Prettier from 1.17 to 2.0.2.
Summary: This gets us on the latest Prettier 2.x: https://prettier.io/blog/2020/03/21/2.0.0.html Notably, this adds support for TypeScript 3.8, which introduces new syntax, such as `import type`. Reviewed By: zertosh Differential Revision: D20636268 fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
79c69bea02
commit
cf44650b3f
+8
-13
@@ -116,7 +116,7 @@ function generatePropsString(component: ComponentShape, imports) {
|
||||
}
|
||||
|
||||
return component.props
|
||||
.map(prop => {
|
||||
.map((prop) => {
|
||||
return `void set${toSafeJavaString(
|
||||
prop.name,
|
||||
)}(T view, ${getJavaValueForProp(prop, imports)});`;
|
||||
@@ -148,7 +148,7 @@ function getCommandArguments(
|
||||
): string {
|
||||
return [
|
||||
'T view',
|
||||
...command.typeAnnotation.params.map(param => {
|
||||
...command.typeAnnotation.params.map((param) => {
|
||||
const commandArgJavaType = getCommandArgJavaType(param);
|
||||
|
||||
return `${commandArgJavaType} ${param.name}`;
|
||||
@@ -161,7 +161,7 @@ function generateCommandsString(
|
||||
componentName: string,
|
||||
) {
|
||||
return component.commands
|
||||
.map(command => {
|
||||
.map((command) => {
|
||||
const safeJavaName = toSafeJavaString(command.name, false);
|
||||
|
||||
return `void ${safeJavaName}(${getCommandArguments(
|
||||
@@ -174,7 +174,7 @@ function generateCommandsString(
|
||||
|
||||
function getClassExtendString(component): string {
|
||||
const extendString = component.extendsProps
|
||||
.map(extendProps => {
|
||||
.map((extendProps) => {
|
||||
switch (extendProps.type) {
|
||||
case 'ReactNativeBuiltInType':
|
||||
switch (extendProps.knownTypeName) {
|
||||
@@ -201,7 +201,7 @@ module.exports = {
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const files = new Map();
|
||||
Object.keys(schema.modules).forEach(moduleName => {
|
||||
Object.keys(schema.modules).forEach((moduleName) => {
|
||||
const components = schema.modules[moduleName].components;
|
||||
// No components in this module
|
||||
if (components == null) {
|
||||
@@ -209,11 +209,11 @@ module.exports = {
|
||||
}
|
||||
|
||||
return Object.keys(components)
|
||||
.filter(componentName => {
|
||||
.filter((componentName) => {
|
||||
const component = components[componentName];
|
||||
return component.excludedPlatform !== 'android';
|
||||
})
|
||||
.forEach(componentName => {
|
||||
.forEach((componentName) => {
|
||||
const component = components[componentName];
|
||||
const className = getInterfaceJavaClassName(componentName);
|
||||
const fileName = `${className}.java`;
|
||||
@@ -227,12 +227,7 @@ module.exports = {
|
||||
const extendString = getClassExtendString(component);
|
||||
|
||||
const replacedTemplate = template
|
||||
.replace(
|
||||
/::_IMPORTS_::/g,
|
||||
Array.from(imports)
|
||||
.sort()
|
||||
.join('\n'),
|
||||
)
|
||||
.replace(/::_IMPORTS_::/g, Array.from(imports).sort().join('\n'))
|
||||
.replace(/::_CLASSNAME_::/g, className)
|
||||
.replace('::_EXTEND_CLASSES_::', extendString)
|
||||
.replace(
|
||||
|
||||
Reference in New Issue
Block a user