mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 22:18:54 +08:00
chore: migrate oxlint & oxfmt (#15464)
#### PR Dependency Tree * **PR #15464** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Replaced the project’s formatting and linting workflow with Oxfmt and Oxlint. * Added shared formatting and linting configuration, editor integration, and updated automated checks. * Updated generated files, scripts, and lint guidance to use the new tooling. * **Style** * Reformatted templates, source code, examples, and configuration files for consistent readability. * No user-facing functionality or rendering behavior changed. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -18,12 +18,24 @@ export abstract class BaseAdapter<AdapterTarget = unknown> {
|
||||
return this.job.adapterConfigs;
|
||||
}
|
||||
|
||||
abstract fromDocSnapshot(payload: FromDocSnapshotPayload): Promise<FromDocSnapshotResult<AdapterTarget>>;
|
||||
abstract fromBlockSnapshot(payload: FromBlockSnapshotPayload): Promise<FromBlockSnapshotResult<AdapterTarget>>;
|
||||
abstract fromSliceSnapshot(payload: FromSliceSnapshotPayload): Promise<FromSliceSnapshotResult<AdapterTarget>>;
|
||||
abstract toDocSnapshot(payload: ToDocSnapshotPayload<AdapterTarget>): Promise<DocSnapshot>;
|
||||
abstract toBlockSnapshot(payload: ToBlockSnapshotPayload<AdapterTarget>): Promise<BlockSnapshot>;
|
||||
abstract toSliceSnapshot(payload: ToSliceSnapshotPayload<AdapterTarget>): Promise<SliceSnapshot | null>;
|
||||
abstract fromDocSnapshot(
|
||||
payload: FromDocSnapshotPayload
|
||||
): Promise<FromDocSnapshotResult<AdapterTarget>>;
|
||||
abstract fromBlockSnapshot(
|
||||
payload: FromBlockSnapshotPayload
|
||||
): Promise<FromBlockSnapshotResult<AdapterTarget>>;
|
||||
abstract fromSliceSnapshot(
|
||||
payload: FromSliceSnapshotPayload
|
||||
): Promise<FromSliceSnapshotResult<AdapterTarget>>;
|
||||
abstract toDocSnapshot(
|
||||
payload: ToDocSnapshotPayload<AdapterTarget>
|
||||
): Promise<DocSnapshot>;
|
||||
abstract toBlockSnapshot(
|
||||
payload: ToBlockSnapshotPayload<AdapterTarget>
|
||||
): Promise<BlockSnapshot>;
|
||||
abstract toSliceSnapshot(
|
||||
payload: ToSliceSnapshotPayload<AdapterTarget>
|
||||
): Promise<SliceSnapshot | null>;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -123,7 +123,10 @@ type MyCommandOptions = {
|
||||
configA: number;
|
||||
configB: string;
|
||||
};
|
||||
export const myCommand: Command<never, never, MyCommandOptions> = (ctx, next) => {
|
||||
export const myCommand: Command<never, never, MyCommandOptions> = (
|
||||
ctx,
|
||||
next
|
||||
) => {
|
||||
const { configA, configB } = ctx;
|
||||
|
||||
if (fail) {
|
||||
|
||||
@@ -46,7 +46,12 @@ export class SimplePageEditor extends LitElement {
|
||||
doc!: Doc;
|
||||
|
||||
override render() {
|
||||
return html` <editor-host .doc=${this.doc} .specs=${PageEditorBlockSpecs}></editor-host> `;
|
||||
return html`
|
||||
<editor-host
|
||||
.doc=${this.doc}
|
||||
.specs=${PageEditorBlockSpecs}
|
||||
></editor-host>
|
||||
`;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -81,7 +81,11 @@ function createDoc() {
|
||||
});
|
||||
doc.addBlock('affine:surface', {}, pageBlockId);
|
||||
const noteId = doc.addBlock('affine:note', {}, pageBlockId);
|
||||
doc.addBlock('affine:paragraph', { text: new Text('Hello World!') }, noteId);
|
||||
doc.addBlock(
|
||||
'affine:paragraph',
|
||||
{ text: new Text('Hello World!') },
|
||||
noteId
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,9 @@ const attributeRenderer: AttributeRenderer<AffineTextAttributes> = (
|
||||
selected
|
||||
) => {
|
||||
// Generate style from delta
|
||||
return html`<span style=${style}><v-text .str=${delta.insert}></v-text></span>`;
|
||||
return html`<span style=${style}
|
||||
><v-text .str=${delta.insert}></v-text
|
||||
></span>`;
|
||||
};
|
||||
|
||||
const doc = new Y.Doc();
|
||||
|
||||
@@ -188,7 +188,11 @@ export class RootService extends BlockService<RootBlockModel> {
|
||||
// Introducing commands!
|
||||
this.std.command
|
||||
.chain()
|
||||
.tryAll(chain => [chain.getTextSelection(), chain.getImageSelections(), chain.getBlockSelections()])
|
||||
.tryAll(chain => [
|
||||
chain.getTextSelection(),
|
||||
chain.getImageSelections(),
|
||||
chain.getBlockSelections(),
|
||||
])
|
||||
.getSelectedBlocks()
|
||||
.inline(({ selectedBlocks }) => {
|
||||
if (!selectedBlocks) return;
|
||||
|
||||
Reference in New Issue
Block a user