From 5240f08fc93c2e70a730bd757adcc545b0b48973 Mon Sep 17 00:00:00 2001 From: streamich Date: Thu, 2 May 2024 19:28:36 +0200 Subject: [PATCH] =?UTF-8?q?style(json-crdt-extensions):=20=F0=9F=92=84=20r?= =?UTF-8?q?un=20Prettier=20and=20remove=20todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../peritext/PeritextApi.ts | 3 +- .../peritext/constants.ts | 38 +++++++++---------- src/json-crdt-extensions/peritext/types.ts | 6 +-- src/json-crdt/extensions/index.ts | 3 -- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/json-crdt-extensions/peritext/PeritextApi.ts b/src/json-crdt-extensions/peritext/PeritextApi.ts index 57deb7345e..266dda972b 100644 --- a/src/json-crdt-extensions/peritext/PeritextApi.ts +++ b/src/json-crdt-extensions/peritext/PeritextApi.ts @@ -2,5 +2,4 @@ import {NodeApi} from '../../json-crdt/model/api/nodes'; import type {PeritextNode} from './PeritextNode'; import type {ExtensionApi} from '../../json-crdt'; -export class PeritextApi extends NodeApi implements ExtensionApi { -} +export class PeritextApi extends NodeApi implements ExtensionApi {} diff --git a/src/json-crdt-extensions/peritext/constants.ts b/src/json-crdt-extensions/peritext/constants.ts index a6191aa6c3..7d5a772248 100644 --- a/src/json-crdt-extensions/peritext/constants.ts +++ b/src/json-crdt-extensions/peritext/constants.ts @@ -1,6 +1,6 @@ -import {nodes, s} from "../../json-crdt-patch"; -import {ExtensionId, ExtensionName} from "../constants"; -import {SliceSchema} from "./slice/types"; +import {nodes, s} from '../../json-crdt-patch'; +import {ExtensionId, ExtensionName} from '../constants'; +import {SliceSchema} from './slice/types'; export const enum Chars { BlockSplitSentinel = '\n', @@ -8,22 +8,20 @@ export const enum Chars { export const MNEMONIC = ExtensionName[ExtensionId.peritext]; -export const BUILD_SCHEMA = (text: string) => ( - s.vec<[ - /** - * The text of the node. All rich-text textual data is stored in this node. - */ - str: nodes.str, - - /** - * The slices of the node. All rich-text annotations are stored in this - * node. - */ - slices: nodes.arr, - ]>( - s.str(text), - s.arr([]), - ) -); +export const BUILD_SCHEMA = (text: string) => + s.vec< + [ + /** + * The text of the node. All rich-text textual data is stored in this node. + */ + str: nodes.str, + + /** + * The slices of the node. All rich-text annotations are stored in this + * node. + */ + slices: nodes.arr, + ] + >(s.str(text), s.arr([])); export const SCHEMA = BUILD_SCHEMA(''); diff --git a/src/json-crdt-extensions/peritext/types.ts b/src/json-crdt-extensions/peritext/types.ts index b400bd91b0..c4f516049a 100644 --- a/src/json-crdt-extensions/peritext/types.ts +++ b/src/json-crdt-extensions/peritext/types.ts @@ -1,9 +1,9 @@ -import type {SchemaToJsonNode} from "../../json-crdt/schema/types"; -import type {SCHEMA} from "./constants"; +import type {SchemaToJsonNode} from '../../json-crdt/schema/types'; +import type {SCHEMA} from './constants'; /** * Represents an object which state can change over time. - * + * * @todo Move to /src/utils. */ export interface Stateful { diff --git a/src/json-crdt/extensions/index.ts b/src/json-crdt/extensions/index.ts index ea3cbe3ff6..c55d43d037 100644 --- a/src/json-crdt/extensions/index.ts +++ b/src/json-crdt/extensions/index.ts @@ -3,9 +3,6 @@ import {NodeBuilder} from '../../json-crdt-patch/builder/DelayedValueBuilder'; import {konst} from '../../json-crdt-patch/builder/Konst'; import type {ITimestampStruct} from '../../json-crdt-patch/clock'; -/** - * @todo Replace this by `s` builder. - */ export const ext = (extensionId: number, nodeBuilder: NodeBuilder) => new NodeBuilder((builder: PatchBuilder): ITimestampStruct => { // Extension tuple starts with a 3-byte header: