mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Collapse object initialization in Xplat
Summary: Collapse multiline object initialization into one single object literal (as much as possible). Run codemod (requires temporary xplat task runner config changes), then manual fixes. ``` ./scripts/typedjs/flow/runner codemod lti/collapseObjectInitialization ~/fbsource/xplat/js/ ``` - Announcement: [post](https://fb.workplace.com/groups/flowlang/posts/903386663600331) - Support group: [Flow Support](https://fb.workplace.com/groups/flow) drop-conflicts Format: ``` arc f ``` Sort imports ``` hg l -n | xargs js1 lint --fix --rule 'fb-tools/sort-requires' ``` Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D36112168 fbshipit-source-id: 23db87c3bd8ffe693019ffeb5ac8300ec46c8532
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0337a2981d
commit
e7d9e4dbb5
@@ -33,7 +33,7 @@ describe('stringifySafe', () => {
|
||||
});
|
||||
|
||||
it('stringifySafe stringifies circular objects with toString', () => {
|
||||
const arg = {};
|
||||
const arg: {arg?: {...}} = {...null};
|
||||
arg.arg = arg;
|
||||
const result = stringifySafe(arg);
|
||||
expect(result).toEqual('[object Object]');
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import type {CommandOptions} from './options';
|
||||
import type {TypeDeclarationMap} from '../utils';
|
||||
|
||||
import type {CommandOptions} from './options';
|
||||
import type {ComponentSchemaBuilderConfig} from './schema.js';
|
||||
|
||||
const {getTypes} = require('../utils');
|
||||
const {getCommands} = require('./commands');
|
||||
const {getEvents} = require('./events');
|
||||
const {getProps, getPropProperties} = require('./props');
|
||||
const {getCommandOptions, getOptions} = require('./options');
|
||||
const {getExtendsProps, removeKnownExtends} = require('./extends');
|
||||
const {getTypes} = require('../utils');
|
||||
const {getCommandOptions, getOptions} = require('./options');
|
||||
const {getPropProperties, getProps} = require('./props');
|
||||
|
||||
function findComponentConfig(ast) {
|
||||
const foundConfigs = [];
|
||||
@@ -41,9 +41,10 @@ function findComponentConfig(ast) {
|
||||
const typeArgumentParams = declaration.typeArguments.params;
|
||||
const funcArgumentParams = declaration.arguments;
|
||||
|
||||
const nativeComponentType = {};
|
||||
nativeComponentType.propsTypeName = typeArgumentParams[0].id.name;
|
||||
nativeComponentType.componentName = funcArgumentParams[0].value;
|
||||
const nativeComponentType: {[string]: string} = {
|
||||
propsTypeName: typeArgumentParams[0].id.name,
|
||||
componentName: funcArgumentParams[0].value,
|
||||
};
|
||||
if (funcArgumentParams.length > 1) {
|
||||
nativeComponentType.optionsExpression = funcArgumentParams[1];
|
||||
}
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import type {CommandOptions} from './options';
|
||||
import type {TypeDeclarationMap} from '../utils';
|
||||
|
||||
import type {CommandOptions} from './options';
|
||||
import type {ComponentSchemaBuilderConfig} from './schema.js';
|
||||
|
||||
const {getTypes} = require('../utils');
|
||||
const {getCommands} = require('./commands');
|
||||
const {getEvents} = require('./events');
|
||||
const {getProps, getPropProperties} = require('./props');
|
||||
const {getCommandOptions, getOptions} = require('./options');
|
||||
const {getExtendsProps, removeKnownExtends} = require('./extends');
|
||||
const {getTypes} = require('../utils');
|
||||
const {getCommandOptions, getOptions} = require('./options');
|
||||
const {getPropProperties, getProps} = require('./props');
|
||||
|
||||
function findComponentConfig(ast) {
|
||||
const foundConfigs = [];
|
||||
@@ -41,9 +41,10 @@ function findComponentConfig(ast) {
|
||||
const typeArgumentParams = declaration.typeParameters.params;
|
||||
const funcArgumentParams = declaration.arguments;
|
||||
|
||||
const nativeComponentType = {};
|
||||
nativeComponentType.propsTypeName = typeArgumentParams[0].typeName.name;
|
||||
nativeComponentType.componentName = funcArgumentParams[0].value;
|
||||
const nativeComponentType: {[string]: string} = {
|
||||
propsTypeName: typeArgumentParams[0].typeName.name,
|
||||
componentName: funcArgumentParams[0].value,
|
||||
};
|
||||
if (funcArgumentParams.length > 1) {
|
||||
nativeComponentType.optionsExpression = funcArgumentParams[1];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user