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:
@@ -267,16 +267,18 @@ export class AffineDragHandleWidget extends WidgetComponent<RootBlockModel> {
|
||||
</div>
|
||||
<div class="affine-drag-handle-container">
|
||||
<div class=${classMap(classes)}>
|
||||
${isGfx
|
||||
? html`
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
`
|
||||
: nothing}
|
||||
${
|
||||
isGfx
|
||||
? html`
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
<div class="dot"></div>
|
||||
`
|
||||
: nothing
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="affine-drag-hover-rect" style=${hoverRectStyle}></div>
|
||||
|
||||
@@ -599,9 +599,11 @@ export class EdgelessAutoConnectWidget extends WidgetComponent<RootBlockModel> {
|
||||
|
||||
return html`${this._PageVisibleIndexLabels(elements, counts)}
|
||||
${this._EdgelessOnlyLabels()}
|
||||
${this._index >= 0 && this._index < elements.length
|
||||
? this._NavigatorComponent(elements)
|
||||
: nothing} `;
|
||||
${
|
||||
this._index >= 0 && this._index < elements.length
|
||||
? this._NavigatorComponent(elements)
|
||||
: nothing
|
||||
} `;
|
||||
}
|
||||
|
||||
@state()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* oxlint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* oxlint-disable typescript/no-non-null-assertion */
|
||||
import {
|
||||
DefaultTool,
|
||||
EdgelessLegacySlotIdentifier,
|
||||
@@ -684,25 +684,28 @@ export class EdgelessToolbarWidget extends WidgetComponent<RootBlockModel> {
|
||||
>
|
||||
<div
|
||||
class="edgeless-toolbar-container"
|
||||
data-dense-quick=${this._denseQuickTools &&
|
||||
this._hiddenQuickTools.length > 0}
|
||||
data-dense-quick=${
|
||||
this._denseQuickTools && this._hiddenQuickTools.length > 0
|
||||
}
|
||||
data-dense-senior=${this._denseSeniorTools}
|
||||
@dblclick=${stopPropagation}
|
||||
@mousedown=${stopPropagation}
|
||||
@pointerdown=${stopPropagation}
|
||||
>
|
||||
${this.isPresentMode
|
||||
? html`<presentation-toolbar
|
||||
.edgeless=${this.block}
|
||||
.settingMenuShow=${this.presentSettingMenuShow}
|
||||
.frameMenuShow=${this.presentFrameMenuShow}
|
||||
.setSettingMenuShow=${(show: boolean) =>
|
||||
(this.presentSettingMenuShow = show)}
|
||||
.setFrameMenuShow=${(show: boolean) =>
|
||||
(this.presentFrameMenuShow = show)}
|
||||
.containerWidth=${this.containerWidth}
|
||||
></presentation-toolbar>`
|
||||
: nothing}
|
||||
${
|
||||
this.isPresentMode
|
||||
? html`<presentation-toolbar
|
||||
.edgeless=${this.block}
|
||||
.settingMenuShow=${this.presentSettingMenuShow}
|
||||
.frameMenuShow=${this.presentFrameMenuShow}
|
||||
.setSettingMenuShow=${(show: boolean) =>
|
||||
(this.presentSettingMenuShow = show)}
|
||||
.setFrameMenuShow=${(show: boolean) =>
|
||||
(this.presentFrameMenuShow = show)}
|
||||
.containerWidth=${this.containerWidth}
|
||||
></presentation-toolbar>`
|
||||
: nothing
|
||||
}
|
||||
${this.isPresentMode ? nothing : this._renderContent()}
|
||||
</div>
|
||||
</smooth-corner>
|
||||
|
||||
@@ -287,9 +287,11 @@ export class LinkedDocPopover extends SignalWatcher(
|
||||
<div class="divider" ?hidden=${idx === 0}></div>
|
||||
<div class="group-title">
|
||||
<div class="group-title-text">${group.name}</div>
|
||||
${group.isLoading
|
||||
? html`<span class="loading-icon">${LoadingIcon()}</span>`
|
||||
: nothing}
|
||||
${
|
||||
group.isLoading
|
||||
? html`<span class="loading-icon">${LoadingIcon()}</span>`
|
||||
: nothing
|
||||
}
|
||||
</div>
|
||||
<div class="group" style=${group.styles ?? ''}>
|
||||
${group.items.map(({ key, name, icon, action }) => {
|
||||
|
||||
@@ -94,16 +94,13 @@ export async function blobsFromAssets(
|
||||
}
|
||||
|
||||
return Promise.all(
|
||||
Array.from(
|
||||
assets,
|
||||
async ([blobId, file]): Promise<ImportBlob> => ({
|
||||
blobId,
|
||||
sourcePath: sourcePathByBlobId.get(blobId) ?? file.name,
|
||||
fileName: file.name,
|
||||
mime: file.type,
|
||||
bytes: new Uint8Array(await file.arrayBuffer()),
|
||||
})
|
||||
)
|
||||
Array.from(assets, async ([blobId, file]): Promise<ImportBlob> => ({
|
||||
blobId,
|
||||
sourcePath: sourcePathByBlobId.get(blobId) ?? file.name,
|
||||
fileName: file.name,
|
||||
mime: file.type,
|
||||
bytes: new Uint8Array(await file.arrayBuffer()),
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ export function getSelectingBlockPaths(
|
||||
}
|
||||
|
||||
// Filter out the blocks which parent is in the blocks
|
||||
// oxlint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
// oxlint-disable-next-line typescript/prefer-for-of
|
||||
for (let i = 0; i < blocks.length; i++) {
|
||||
const block = blocks[i];
|
||||
const parent = blocks[i].element.store.getParent(block.element.model);
|
||||
|
||||
@@ -346,11 +346,13 @@ export class AffineDocRemoteSelectionWidget extends WidgetComponent {
|
||||
.concat([
|
||||
html`
|
||||
<div
|
||||
style="${cursorRect
|
||||
? cursorStyle(cursorRect, color)
|
||||
: styleMap({
|
||||
display: 'none',
|
||||
})}"
|
||||
style="${
|
||||
cursorRect
|
||||
? cursorStyle(cursorRect, color)
|
||||
: styleMap({
|
||||
display: 'none',
|
||||
})
|
||||
}"
|
||||
>
|
||||
<div
|
||||
style="${styleMap({
|
||||
|
||||
@@ -335,12 +335,14 @@ export class SlashMenu extends WithDisposable(LitElement) {
|
||||
visibility: 'hidden',
|
||||
};
|
||||
|
||||
return html`${this._queryState !== 'no_result'
|
||||
? html` <div
|
||||
class="overlay-mask"
|
||||
@click="${() => this.abortController.abort()}"
|
||||
></div>`
|
||||
: nothing}
|
||||
return html`${
|
||||
this._queryState !== 'no_result'
|
||||
? html` <div
|
||||
class="overlay-mask"
|
||||
@click="${() => this.abortController.abort()}"
|
||||
></div>`
|
||||
: nothing
|
||||
}
|
||||
<inner-slash-menu
|
||||
.context=${this._innerSlashMenuContext}
|
||||
.menu=${this._queryState === 'off' ? this.items : this._filteredItems}
|
||||
@@ -441,19 +443,21 @@ export class InnerSlashMenu extends WithDisposable(LitElement) {
|
||||
@click=${() => this.context.onClickItem(item)}
|
||||
>
|
||||
${icon && html`<div class="slash-menu-item-icon">${icon}</div>`}
|
||||
${tooltip &&
|
||||
html`<affine-tooltip
|
||||
tip-position="right"
|
||||
.offset=${22}
|
||||
.tooltipStyle=${slashItemToolTipStyle}
|
||||
.hoverOptions=${{
|
||||
enterDelay: AFFINE_SLASH_MENU_TOOLTIP_TIMEOUT,
|
||||
allowMultiple: false,
|
||||
}}
|
||||
>
|
||||
<div class="tooltip-figure">${tooltip.figure}</div>
|
||||
<div class="tooltip-caption">${tooltip.caption}</div>
|
||||
</affine-tooltip>`}
|
||||
${
|
||||
tooltip &&
|
||||
html`<affine-tooltip
|
||||
tip-position="right"
|
||||
.offset=${22}
|
||||
.tooltipStyle=${slashItemToolTipStyle}
|
||||
.hoverOptions=${{
|
||||
enterDelay: AFFINE_SLASH_MENU_TOOLTIP_TIMEOUT,
|
||||
allowMultiple: false,
|
||||
}}
|
||||
>
|
||||
<div class="tooltip-figure">${tooltip.figure}</div>
|
||||
<div class="tooltip-caption">${tooltip.caption}</div>
|
||||
</affine-tooltip>`
|
||||
}
|
||||
</icon-button>`;
|
||||
};
|
||||
|
||||
|
||||
@@ -390,9 +390,11 @@ function renderActionItem(action: ToolbarAction, context: ToolbarContext) {
|
||||
@click=${() => action.run?.(context)}
|
||||
>
|
||||
${action.icon}
|
||||
${action.showLabel && action.label
|
||||
? html`<span class="label">${action.label}</span>`
|
||||
: null}
|
||||
${
|
||||
action.showLabel && action.label
|
||||
? html`<span class="label">${action.label}</span>`
|
||||
: null
|
||||
}
|
||||
</editor-icon-button>
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user