From 681bef6262b7eb5c7f699a2b44eb5e2d167cccdc Mon Sep 17 00:00:00 2001 From: Vadim Demedes Date: Sat, 11 May 2024 20:07:23 +0300 Subject: [PATCH] Format code --- src/ink.tsx | 20 ++++++++++---------- src/parse-keypress.ts | 8 ++++---- src/render-border.ts | 8 ++++---- src/render-node-to-output.ts | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/ink.tsx b/src/ink.tsx index 0fd5ec239..223c82fa4 100644 --- a/src/ink.tsx +++ b/src/ink.tsx @@ -1,22 +1,22 @@ import process from 'node:process'; -import React, { type ReactNode } from 'react'; +import React, {type ReactNode} from 'react'; import throttle from 'lodash/throttle.js'; -import { type DebouncedFunc } from 'lodash'; +import {type DebouncedFunc} from 'lodash'; import ansiEscapes from 'ansi-escapes'; import isInCi from 'is-in-ci'; import autoBind from 'auto-bind'; import signalExit from 'signal-exit'; import patchConsole from 'patch-console'; -import { type FiberRoot } from 'react-reconciler'; +import {type FiberRoot} from 'react-reconciler'; import Yoga from 'yoga-wasm-web/auto'; import reconciler from './reconciler.js'; import render from './renderer.js'; import * as dom from './dom.js'; -import logUpdate, { type LogUpdate } from './log-update.js'; +import logUpdate, {type LogUpdate} from './log-update.js'; import instances from './instances.js'; import App from './components/App.js'; -const noop = () => { }; +const noop = () => {}; export type Options = { stdout: NodeJS.WriteStream; @@ -91,7 +91,7 @@ export default class Ink { ); // Unmount when process exits - this.unsubscribeExit = signalExit(this.unmount, { alwaysLast: false }); + this.unsubscribeExit = signalExit(this.unmount, {alwaysLast: false}); if (process.env['DEV'] === 'true') { reconciler.injectIntoDevTools({ @@ -121,9 +121,9 @@ export default class Ink { this.onRender(); }; - resolveExitPromise: () => void = () => { }; - rejectExitPromise: (reason?: Error) => void = () => { }; - unsubscribeExit: () => void = () => { }; + resolveExitPromise: () => void = () => {}; + rejectExitPromise: (reason?: Error) => void = () => {}; + unsubscribeExit: () => void = () => {}; calculateLayout = () => { // The 'columns' property can be undefined or 0 when not using a TTY. @@ -144,7 +144,7 @@ export default class Ink { return; } - const { output, outputHeight, staticOutput } = render(this.rootNode); + const {output, outputHeight, staticOutput} = render(this.rootNode); // If output isn't empty, it means new children have been added to it const hasStaticOutput = staticOutput && staticOutput !== '\n'; diff --git a/src/parse-keypress.ts b/src/parse-keypress.ts index b52059eaa..130fab984 100644 --- a/src/parse-keypress.ts +++ b/src/parse-keypress.ts @@ -88,7 +88,7 @@ const keyName: Record = { '[7^': 'home', '[8^': 'end', /* misc. */ - '[Z': 'tab' + '[Z': 'tab', }; export const nonAlphanumericKeys = [...Object.values(keyName), 'backspace']; @@ -106,7 +106,7 @@ const isShiftKey = (code: string) => { '[6$', '[7$', '[8$', - '[Z' + '[Z', ].includes(code); }; @@ -122,7 +122,7 @@ const isCtrlKey = (code: string) => { '[5^', '[6^', '[7^', - '[8^' + '[8^', ].includes(code); }; @@ -160,7 +160,7 @@ const parseKeypress = (s: Buffer | string = ''): ParsedKey => { shift: false, option: false, sequence: s, - raw: s + raw: s, }; key.sequence = key.sequence || s || key.name; diff --git a/src/render-border.ts b/src/render-border.ts index a9c6ba1f4..60b50f3e0 100644 --- a/src/render-border.ts +++ b/src/render-border.ts @@ -1,7 +1,7 @@ import cliBoxes from 'cli-boxes'; import chalk from 'chalk'; import colorize from './colorize.js'; -import { type DOMNode } from './dom.js'; +import {type DOMNode} from './dom.js'; import type Output from './output.js'; const renderBorder = ( @@ -103,11 +103,11 @@ const renderBorder = ( const offsetY = showTopBorder ? 1 : 0; if (topBorder) { - output.write(x, y, topBorder, { transformers: [] }); + output.write(x, y, topBorder, {transformers: []}); } if (showLeftBorder) { - output.write(x, y + offsetY, leftBorder, { transformers: [] }); + output.write(x, y + offsetY, leftBorder, {transformers: []}); } if (showRightBorder) { @@ -117,7 +117,7 @@ const renderBorder = ( } if (bottomBorder) { - output.write(x, y + height - 1, bottomBorder, { transformers: [] }); + output.write(x, y + height - 1, bottomBorder, {transformers: []}); } } }; diff --git a/src/render-node-to-output.ts b/src/render-node-to-output.ts index 05e3e9a6e..965f90e2a 100644 --- a/src/render-node-to-output.ts +++ b/src/render-node-to-output.ts @@ -5,7 +5,7 @@ import wrapText from './wrap-text.js'; import getMaxWidth from './get-max-width.js'; import squashTextNodes from './squash-text-nodes.js'; import renderBorder from './render-border.js'; -import { type DOMElement } from './dom.js'; +import {type DOMElement} from './dom.js'; import type Output from './output.js'; // If parent container is ``, text nodes will be treated as separate nodes in @@ -50,7 +50,7 @@ const renderNodeToOutput = ( return; } - const { yogaNode } = node; + const {yogaNode} = node; if (yogaNode) { if (yogaNode.getDisplay() === Yoga.DISPLAY_NONE) { @@ -83,7 +83,7 @@ const renderNodeToOutput = ( text = applyPaddingToText(node, text); - output.write(x, y, text, { transformers: newTransformers }); + output.write(x, y, text, {transformers: newTransformers}); } return; @@ -120,7 +120,7 @@ const renderNodeToOutput = ( yogaNode.getComputedBorder(Yoga.EDGE_BOTTOM) : undefined; - output.clip({ x1, x2, y1, y2 }); + output.clip({x1, x2, y1, y2}); clipped = true; } }