Skip to content

Commit 846824c

Browse files
committed
style: 💄 fix linter issues
1 parent d2ad754 commit 846824c

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

src/json-crdt-extensions/peritext/editor/Editor.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {printTree} from 'tree-dump/lib/printTree';
77
import {createRegistry} from '../registry/registry';
88
import {PersistedSlice} from '../slice/PersistedSlice';
99
import {stringify} from '../../../json-text/stringify';
10-
import {CommonSliceType, type SliceTypeSteps, type SliceType, SliceTypeStep} from '../slice';
10+
import {CommonSliceType, type SliceTypeSteps, type SliceType, type SliceTypeStep} from '../slice';
1111
import {isLetter, isPunctuation, isWhitespace, stepsEqual} from './util';
1212
import {ValueSyncStore} from '../../../util/events/sync-store';
1313
import {MarkerOverlayPoint} from '../overlay/MarkerOverlayPoint';
@@ -861,7 +861,13 @@ export class Editor<T = string> implements Printable {
861861
return slices.slices.insMarkerAfter(after.id, type, data);
862862
}
863863

864-
public tglMarkerAt(point: Point<T>, type: SliceType, data?: unknown, slices: EditorSlices<T> = this.saved, def: SliceTypeStep = SliceTypeCon.p): void {
864+
public tglMarkerAt(
865+
point: Point<T>,
866+
type: SliceType,
867+
data?: unknown,
868+
slices: EditorSlices<T> = this.saved,
869+
def: SliceTypeStep = SliceTypeCon.p,
870+
): void {
865871
const overlay = this.txt.overlay;
866872
const markerPoint = overlay.getOrNextLowerMarker(point);
867873
if (markerPoint) {
@@ -872,8 +878,7 @@ export class Editor<T = string> implements Printable {
872878
if (tag === typeTag) type = [...type.slice(0, -1), def];
873879
if (Array.isArray(type) && type.length === 1) type = type[0];
874880
marker.update({type});
875-
} else
876-
this.setStartMarker(type, data, slices);
881+
} else this.setStartMarker(type, data, slices);
877882
}
878883

879884
public updMarkerAt(point: Point<T>, type: SliceType, data?: unknown, slices: EditorSlices<T> = this.saved): void {
@@ -883,8 +888,7 @@ export class Editor<T = string> implements Printable {
883888
const marker = markerPoint.marker;
884889
if (Array.isArray(type) && type.length === 1) type = type[0];
885890
marker.update({type});
886-
} else
887-
this.setStartMarker(type, data, slices);
891+
} else this.setStartMarker(type, data, slices);
888892
}
889893

890894
/**
@@ -894,7 +898,12 @@ export class Editor<T = string> implements Printable {
894898
* @param type Slice type to toggle.
895899
* @param data Custom data of the slice.
896900
*/
897-
public tglMarker(type: SliceType, data?: unknown, slices: EditorSlices<T> = this.saved, def: SliceTypeStep = SliceTypeCon.p): void {
901+
public tglMarker(
902+
type: SliceType,
903+
data?: unknown,
904+
slices: EditorSlices<T> = this.saved,
905+
def: SliceTypeStep = SliceTypeCon.p,
906+
): void {
898907
for (let i = this.cursors0(), cursor = i(); cursor; cursor = i())
899908
this.tglMarkerAt(cursor.start, type, data, slices, def);
900909
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ export class Overlay<T = string> implements Printable, Stateful {
497497
}
498498

499499
public skipMarkers(point: Point<T>, direction: -1 | 1): boolean {
500-
while (1) {
500+
while (true) {
501501
const isMarker = this.isMarker(point.id);
502502
if (!isMarker) return true;
503503
const end = point.step(direction);

src/json-crdt-peritext-ui/plugins/debug/RenderBlock.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ export const RenderBlock: React.FC<RenderBlockProps> = ({block, hash, children})
3737
<DebugLabel right={hash.toString(36)}>{block.path.map((type) => formatType(type)).join('.')}</DebugLabel>
3838
</div>
3939
)}
40-
{showSliceOutlines
41-
? <div style={{outline: '1px dotted blue'}}>{children}</div>
42-
: children}
40+
{showSliceOutlines ? <div style={{outline: '1px dotted blue'}}>{children}</div> : children}
4341
</div>
4442
);
4543
};

src/json-crdt-peritext-ui/plugins/debug/RenderPeritext.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ export interface RenderPeritextProps extends PeritextViewProps {
3535
ctx?: PeritextSurfaceState;
3636
}
3737

38-
export const RenderPeritext: React.FC<RenderPeritextProps> = ({
39-
state: state_,
40-
ctx,
41-
button,
42-
children,
43-
}) => {
38+
export const RenderPeritext: React.FC<RenderPeritextProps> = ({state: state_, ctx, button, children}) => {
4439
const theme = useTheme();
4540
const state = React.useMemo(() => state_ ?? new DebugState(), [state_]);
4641
useSyncStore(state.enabled);
@@ -80,7 +75,11 @@ export const RenderPeritext: React.FC<RenderPeritextProps> = ({
8075
bg: theme.bg,
8176
})}
8277
>
83-
<Button small active={state.enabled.getSnapshot()} onClick={() => state.enabled.next(!state.enabled.getSnapshot())}>
78+
<Button
79+
small
80+
active={state.enabled.getSnapshot()}
81+
onClick={() => state.enabled.next(!state.enabled.getSnapshot())}
82+
>
8483
Debug
8584
</Button>
8685
</div>

src/json-crdt-peritext-ui/plugins/debug/state/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ export class DebugState implements UiLifeCyclesRender {
3333
/** ------------------------------------------- {@link UiLifeCyclesRender} */
3434

3535
public start() {
36-
return () => {
37-
38-
};
36+
return () => {};
3937
}
4038
}

0 commit comments

Comments
 (0)