Unify ESLint and Prettier across xplat/yoga (#1335)

Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1335

Reviewed By: christophpurrer

Differential Revision: D47459866

fbshipit-source-id: fd6b4e4e2518d91968ac7180b32129b3f70edf88
This commit is contained in:
Nick Gerleman
2023-07-17 14:27:32 -07:00
committed by Facebook GitHub Bot
parent 05b2edfb85
commit 44507ec62e
35 changed files with 2064 additions and 1559 deletions

View File

@@ -15,28 +15,30 @@ import {List, setIn} from 'immutable';
import PositionRecord from './PositionRecord';
import LayoutRecord from './LayoutRecord';
import Sidebar from './Sidebar';
import {Row, Col} from 'antd';
import type {LayoutRecordType} from './LayoutRecord';
import './index.css';
type Props = {
layoutDefinition: Object,
direction: Direction,
maxDepth: number,
maxChildren?: number,
minChildren?: number,
selectedNodePath?: Array<number>,
showGuides: boolean,
className?: string,
height?: string | number,
persist?: boolean,
renderSidebar?: (layoutDefinition: LayoutRecordType, onChange: Function) => any,
layoutDefinition: LayoutRecordType;
direction: Direction;
maxDepth: number;
maxChildren?: number;
minChildren?: number;
selectedNodePath?: Array<number>;
showGuides: boolean;
className?: string;
height?: string | number;
persist?: boolean;
renderSidebar?: (
layoutDefinition: LayoutRecordType,
onChange: () => any,
) => any;
};
type State = {
selectedNodePath?: Array<number>,
layoutDefinition: LayoutRecordType,
direction: Direction,
selectedNodePath?: Array<number>;
layoutDefinition: LayoutRecordType;
direction: Direction;
};
function getPath(path: Array<number>): Array<unknown> {
@@ -62,7 +64,7 @@ export default class Playground extends Component<Props, State> {
persist: false,
};
rehydrate = (node: Object): LayoutRecordType => {
rehydrate = (node: LayoutRecordType): LayoutRecordType => {
let record = LayoutRecord(node);
record = record.set('padding', PositionRecord(record.padding));
record = record.set('border', PositionRecord(record.border));
@@ -115,7 +117,7 @@ export default class Playground extends Component<Props, State> {
};
hideSidePanes() {
if (!Boolean(this.props.renderSidebar)) {
if (!this.props.renderSidebar) {
// only unselect if we don't have an external sidebar, otherwise the
// sidebar may rely on a certain node to be selected
this.setState({
@@ -183,7 +185,9 @@ export default class Playground extends Component<Props, State> {
): string =>
btoa(JSON.stringify(this.removeUnchangedProperties(layoutDefinition)));
removeUnchangedProperties = (node: LayoutRecordType): Object => {
removeUnchangedProperties = (
node: LayoutRecordType,
): {children?: unknown} => {
const untouchedLayout = LayoutRecord({});
const untouchedPosition = PositionRecord({});
const result: {children?: unknown} = {};