Skip to content

Commit 91e6a92

Browse files
committed
style(json-crdt-extensions): 💄 run Prettier
1 parent 5e7fa89 commit 91e6a92

File tree

6 files changed

+22
-34
lines changed

6 files changed

+22
-34
lines changed

src/json-crdt-extensions/peritext/__tests__/setup.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ import {ModelWithExt, ext} from '../../ModelWithExt';
66
export type Schema = ReturnType<typeof schema>;
77
export type Kit = ReturnType<typeof setupKit>;
88

9-
const schema = (text: string) => s.obj({
10-
text: ext.peritext.new(text),
11-
});
9+
const schema = (text: string) =>
10+
s.obj({
11+
text: ext.peritext.new(text),
12+
});
1213

13-
export const setupKit = (initialText: string = '', edits: (model: Model<SchemaToJsonNode<Schema>>) => void = () => {}) => {
14+
export const setupKit = (
15+
initialText: string = '',
16+
edits: (model: Model<SchemaToJsonNode<Schema>>) => void = () => {},
17+
) => {
1418
const model = ModelWithExt.create(schema(initialText));
1519
edits(model);
1620
const api = model.api;

src/json-crdt-extensions/peritext/overlay/Overlay.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class Overlay<T = string> implements Printable, Stateful {
3838

3939
constructor(protected readonly txt: Peritext<T>) {
4040
const id = txt.str.id;
41-
this.START = this.point(id, Anchor.After)
41+
this.START = this.point(id, Anchor.After);
4242
this.END = this.point(id, Anchor.Before);
4343
}
4444

@@ -200,7 +200,7 @@ export class Overlay<T = string> implements Printable, Stateful {
200200
if (isEmpty) {
201201
const u = undefined;
202202
let closed = false;
203-
return () => (closed ? u : (closed = true, [u, u]));
203+
return () => (closed ? u : ((closed = true), [u, u]));
204204
}
205205
let p1: OverlayPoint<T> | undefined;
206206
let p2: OverlayPoint<T> | undefined = after;
@@ -222,15 +222,15 @@ export class Overlay<T = string> implements Printable, Stateful {
222222
p2 = iterator();
223223
}
224224
}
225-
return (p1 || p2) ? [p1, p2] : undefined;
225+
return p1 || p2 ? [p1, p2] : undefined;
226226
};
227227
}
228228

229229
public pairs(after?: undefined | OverlayPoint<T>): IterableIterator<OverlayPair<T>> {
230230
return new UndefEndIter(this.pairs0(after));
231231
}
232232

233-
public tuples0(after: undefined | OverlayPoint<T>): UndefIterator<OverlayTuple<T>> {
233+
public tuples0(after: undefined | OverlayPoint<T>): UndefIterator<OverlayTuple<T>> {
234234
const iterator = this.pairs0(after);
235235
return () => {
236236
const pair = iterator();

src/json-crdt-extensions/peritext/overlay/__tests__/Overlay.pairs.spec.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ const runPairsTests = (setup: () => Kit) => {
1111
const overlay = peritext.overlay;
1212
overlay.refresh();
1313
const pairs = [...overlay.pairs()];
14-
expect(pairs).toEqual([
15-
[undefined, undefined]
16-
]);
14+
expect(pairs).toEqual([[undefined, undefined]]);
1715
});
1816

1917
test('when caret at abs start, returns one pair', () => {
@@ -24,9 +22,7 @@ const runPairsTests = (setup: () => Kit) => {
2422
const pairs = [...overlay.pairs()];
2523
const p1 = overlay.first()!;
2624
expect(peritext.editor.cursor.start.rightChar()?.view()).toBe('0');
27-
expect(pairs).toEqual([
28-
[p1, undefined]
29-
]);
25+
expect(pairs).toEqual([[p1, undefined]]);
3026
});
3127

3228
test('when caret at abs end, returns one pair', () => {
@@ -37,9 +33,7 @@ const runPairsTests = (setup: () => Kit) => {
3733
const pairs = [...overlay.pairs()];
3834
const p1 = overlay.first()!;
3935
expect(peritext.editor.cursor.start.leftChar()?.view()).toBe('9');
40-
expect(pairs).toEqual([
41-
[undefined, p1]
42-
]);
36+
expect(pairs).toEqual([[undefined, p1]]);
4337
});
4438

4539
test('for only caret in overlay, returns two edge pairs', () => {
@@ -142,9 +136,7 @@ const runPairsTests = (setup: () => Kit) => {
142136
overlay.refresh();
143137
const first = overlay.first()!;
144138
const pairs = [...overlay.pairs(first)];
145-
expect(pairs).toEqual([
146-
[first, undefined],
147-
]);
139+
expect(pairs).toEqual([[first, undefined]]);
148140
});
149141

150142
test('in empty overlay, after selection start returns the selection and the edge', () => {

src/json-crdt-extensions/peritext/overlay/__tests__/Overlay.points.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('.points()', () => {
3939
expect(overlay.first()).not.toBe(undefined);
4040
expect(points.length).toBe(3);
4141
});
42-
42+
4343
test('iterates through all points, when points anchored to the same anchor', () => {
4444
const {peritext, overlay} = setupWithOverlay();
4545
peritext.refresh();

src/json-crdt-extensions/peritext/overlay/__tests__/Overlay.tuples.spec.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ const runPairsTests = (setup: () => Kit) => {
1111
const overlay = peritext.overlay;
1212
overlay.refresh();
1313
const list = [...overlay.tuples()];
14-
expect(list).toEqual([
15-
[overlay.START, overlay.END],
16-
]);
14+
expect(list).toEqual([[overlay.START, overlay.END]]);
1715
});
1816

1917
test('when caret at abs start, returns one [p, END] tuple', () => {
@@ -24,9 +22,7 @@ const runPairsTests = (setup: () => Kit) => {
2422
const list = [...overlay.tuples()];
2523
const p1 = overlay.first()!;
2624
expect(peritext.editor.cursor.start.rightChar()?.view()).toBe(peritext.strApi().view()[0]);
27-
expect(list).toEqual([
28-
[p1, overlay.END],
29-
]);
25+
expect(list).toEqual([[p1, overlay.END]]);
3026
});
3127

3228
test('when caret at abs end, returns one [START, p] tuple', () => {
@@ -37,9 +33,7 @@ const runPairsTests = (setup: () => Kit) => {
3733
const list = [...overlay.tuples()];
3834
const p1 = overlay.first()!;
3935
expect(peritext.editor.cursor.start.leftChar()?.view()).toBe(peritext.strApi().view().slice(-1));
40-
expect(list).toEqual([
41-
[overlay.START, p1]
42-
]);
36+
expect(list).toEqual([[overlay.START, p1]]);
4337
});
4438

4539
test('for only caret in overlay, returns two edge tuples', () => {
@@ -139,9 +133,7 @@ const runPairsTests = (setup: () => Kit) => {
139133
overlay.refresh();
140134
const first = overlay.first()!;
141135
const pairs = [...overlay.tuples(first)];
142-
expect(pairs).toEqual([
143-
[first, overlay.END],
144-
]);
136+
expect(pairs).toEqual([[first, overlay.END]]);
145137
});
146138

147139
test('in empty overlay, after selection start returns the selection and the edge', () => {

src/json-crdt-extensions/peritext/overlay/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {OverlayPoint} from "./OverlayPoint";
1+
import type {OverlayPoint} from './OverlayPoint';
22

33
export type BlockTag = [
44
/**

0 commit comments

Comments
 (0)