Skip to content

Commit 41c7559

Browse files
committed
style: 💄 fix linter issues
1 parent 3a3929d commit 41c7559

File tree

15 files changed

+52
-46
lines changed

15 files changed

+52
-46
lines changed

src/json-crdt-peritext-ui/plugins/toolbar/components/UrlDisplayLayout.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,15 @@ export const UrlDisplayLayout: React.FC<UrlDisplayLayoutProps> = ({url, title})
7979
<Favicon domain={domain} url={url} />
8080
</div>
8181
</div>
82-
<div className={domainClass}>{title ? <><strong>{title}</strong>{domainTruncated}</> : domainTruncated}</div>
82+
<div className={domainClass}>
83+
{title ? (
84+
<>
85+
<strong>{title}</strong>{domainTruncated}
86+
</>
87+
) : (
88+
domainTruncated
89+
)}
90+
</div>
8391
</FixedColumn>
8492
<div>
8593
<div className={linkClass}>

src/json-crdt-peritext-ui/plugins/toolbar/cursor/caret/CaretBottomOverlay/index.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react';
33
import {FormattingsManagePane} from '../../../formatting/FormattingsManagePane';
44
import {BottomPanePortal} from '../../util/BottomPanePortal';
55
import {useToolbarPlugin} from '../../../context';
6-
import {PeritextEventDetailMap} from '../../../../../events';
6+
import type {PeritextEventDetailMap} from '../../../../../events';
77
import type {CaretViewProps} from '../../../../../web/react/cursor/CaretView';
88

99
const isDirectCaretPlacement = (event: PeritextEventDetailMap['change']['ev'] | undefined): boolean => {
@@ -12,7 +12,14 @@ const isDirectCaretPlacement = (event: PeritextEventDetailMap['change']['ev'] |
1212
const at = detail.at;
1313
if (Array.isArray(at) && at.length === 1 && typeof at[0] === 'number') return true;
1414
const move = detail.move;
15-
if (Array.isArray(move) && move.length === 1 && Array.isArray(move[0]) && move[0][0] === 'focus' && typeof move[0][1] === 'number') return true;
15+
if (
16+
Array.isArray(move) &&
17+
move.length === 1 &&
18+
Array.isArray(move[0]) &&
19+
move[0][0] === 'focus' &&
20+
typeof move[0][1] === 'number'
21+
)
22+
return true;
1623
}
1724
return false;
1825
};

src/json-crdt-peritext-ui/plugins/toolbar/cursor/util/BottomPanePortal.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ const position: EntangledPortalStateOpts['position'] = (base, dest) => {
1616
const {scrollY} = window;
1717
const body = document.body;
1818
const html = document.documentElement;
19-
const pageHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
19+
const pageHeight = Math.max(
20+
body.scrollHeight,
21+
body.offsetHeight,
22+
html.clientHeight,
23+
html.scrollHeight,
24+
html.offsetHeight,
25+
);
2026
if (base.y + dest.height + scrollY > pageHeight) y = base.y - (base.y + dest.height + scrollY - pageHeight);
2127
return [x, y];
2228
};
@@ -33,9 +39,5 @@ export interface BottomPanePortalProps {
3339
}
3440

3541
export const BottomPanePortal: React.FC<BottomPanePortalProps> = ({children}) => {
36-
return (
37-
<EntangledPortal {...entangledProps}>
38-
{children}
39-
</EntangledPortal>
40-
);
42+
return <EntangledPortal {...entangledProps}>{children}</EntangledPortal>;
4143
};

src/json-crdt-peritext-ui/plugins/toolbar/cursor/util/TopPanePortal.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const spanClass = rule({
1010
const gap = 4;
1111
const position: EntangledPortalStateOpts['position'] = (base, dest) => {
1212
let x = base.x - (dest.width >> 1);
13-
let y = base.y - dest.height;
13+
const y = base.y - dest.height;
1414
if (x < gap) x = gap;
1515
else if (x + dest.width + gap > window.innerWidth) x = window.innerWidth - dest.width - gap;
1616
return [x, y];
@@ -28,9 +28,5 @@ export interface TopPanePortalProps {
2828
}
2929

3030
export const TopPanePortal: React.FC<TopPanePortalProps> = ({children}) => {
31-
return (
32-
<EntangledPortal {...entangledProps}>
33-
{children}
34-
</EntangledPortal>
35-
);
31+
return <EntangledPortal {...entangledProps}>{children}</EntangledPortal>;
3632
};

src/json-crdt-peritext-ui/plugins/toolbar/formatting/FormattingsManagePane/FormattingDisplay.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// biome-ignore lint: lint/style/useImportType
12
import * as React from 'react';
23
import {useT} from 'use-t';
34
import {BasicTooltip} from 'nice-ui/lib/4-card/BasicTooltip';

src/json-crdt-peritext-ui/plugins/toolbar/formatting/FormattingsManagePane/FormattingEditForm.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,7 @@ export const FormattingEditForm: React.FC<FormattingEditFormProps> = ({formattin
4343
<ContextSep line />
4444

4545
<div style={{padding: '16px'}}>
46-
<Button
47-
small
48-
lite={!valid}
49-
positive={validation === 'good'}
50-
block
51-
disabled={!valid}
52-
submit
53-
onClick={() => {}}
54-
>
46+
<Button small lite={!valid} positive={validation === 'good'} block disabled={!valid} submit onClick={() => {}}>
5547
{t('Done')}
5648
</Button>
5749
</div>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as React from "react";
2-
import {FormattingManageState} from "./state";
1+
import * as React from 'react';
2+
import type {FormattingManageState} from './state';
33

44
export const context = React.createContext<FormattingManageState>(null!);
55
export const useFormattingPane = () => React.useContext(context);

src/json-crdt-peritext-ui/plugins/toolbar/formatting/FormattingsManagePane/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const FormattingsManagePane: React.FC<FormattingsManagePaneProps> = ({inl
1616
// biome-ignore lint: too many dependencies
1717
const state = React.useMemo(() => new FormattingManageState(toolbar, inline), [toolbar, inline?.key()]);
1818
const formattings = useBehaviorSubject(React.useMemo(() => state.getFormattings$(), [state]));
19+
// biome-ignore lint: manually manage dependencies
1920
React.useLayoutEffect(() => {
2021
if (formattings.length === 1) {
2122
state.select(formattings[0]);
@@ -30,7 +31,7 @@ export const FormattingsManagePane: React.FC<FormattingsManagePaneProps> = ({inl
3031
<context.Provider value={state}>
3132
<FormattingDisplay
3233
formatting={selected || formattings[0]}
33-
onClose={!selected || (formattings.length === 1) ? void 0 : () => state.select(null)}
34+
onClose={!selected || formattings.length === 1 ? void 0 : () => state.select(null)}
3435
/>
3536
</context.Provider>
3637
);

src/json-crdt-peritext-ui/plugins/toolbar/formatting/FormattingsManagePane/state.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import {SavedFormatting} from '../../state/formattings';
33
import {PersistedSlice} from '../../../../../json-crdt-extensions/peritext/slice/PersistedSlice';
44
import {subject} from '../../../../util/rx';
55
import {toSchema} from '../../../../../json-crdt/schema/toSchema';
6-
import {Model, ObjApi} from '../../../../../json-crdt/model';
7-
import {ObjNode} from '../../../../../json-crdt/nodes';
6+
import {JsonCrdtDiff} from '../../../../../json-crdt-diff/JsonCrdtDiff';
7+
import {Model, type ObjApi} from '../../../../../json-crdt/model';
8+
import type {ObjNode} from '../../../../../json-crdt/nodes';
89
import type {Inline} from '../../../../../json-crdt-extensions';
910
import type {ToolbarState} from '../../state';
10-
import {JsonCrdtDiff} from '../../../../../json-crdt-diff/JsonCrdtDiff';
1111

1212
export class FormattingManageState {
1313
public readonly selected$ = new BehaviorSubject<SavedFormatting | null>(null);

src/json-crdt-peritext-ui/plugins/toolbar/formatting/FormattingsNewPane.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ export const FormattingsNewPane: React.FC<FormattingsNewPaneProps> = ({formattin
3737

3838
return (
3939
<FormattingPane onEsc={() => toolbar.newSlice.next(void 0)}>
40-
<form
41-
className={blockClass}
42-
onSubmit={handleSave}
43-
>
40+
<form className={blockClass} onSubmit={handleSave}>
4441
<ContextPaneHeader short onCloseClick={() => toolbar.newSlice.next(void 0)}>
4542
<FormattingTitle formatting={formatting} />
4643
</ContextPaneHeader>

0 commit comments

Comments
 (0)