mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-21 00:07:01 +08:00
feat: bump eslint & oxlint (#14452)
#### PR Dependency Tree * **PR #14452** 👈 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 * **Bug Fixes** * Improved null-safety, dependency tracking, upload validation, and error logging for more reliable uploads, clipboard, calendar linking, telemetry, PDF/theme printing, and preview/zoom behavior. * Tightened handling of all-day calendar events (missing date now reported). * **Deprecations** * Removed deprecated RadioButton and RadioButtonGroup; use RadioGroup. * **Chores** * Unified and upgraded linting/config, reorganized imports, and standardized binary handling for more consistent builds and tooling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -67,7 +67,7 @@ export const autoScrollOnBoundary = (
|
||||
};
|
||||
|
||||
const cancelBoxListen = effect(() => {
|
||||
box.value;
|
||||
void box.value;
|
||||
startUpdate();
|
||||
});
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ import {
|
||||
DataViewUIBase,
|
||||
DataViewUILogicBase,
|
||||
} from '../../../core/view/data-view-base.js';
|
||||
import { LEFT_TOOL_BAR_WIDTH } from '../consts.js';
|
||||
import {
|
||||
type TableSingleView,
|
||||
TableViewRowSelection,
|
||||
type TableViewSelectionWithType,
|
||||
} from '../../index.js';
|
||||
import { LEFT_TOOL_BAR_WIDTH } from '../consts.js';
|
||||
} from '../selection.js';
|
||||
import type { TableSingleView } from '../table-view-manager.js';
|
||||
import { TableClipboardController } from './controller/clipboard.js';
|
||||
import { TableDragController } from './controller/drag.js';
|
||||
import { TableHotkeysController } from './controller/hotkeys.js';
|
||||
|
||||
@@ -60,10 +60,9 @@ export class BaseExtensionProvider<
|
||||
* @param context - The context object containing scope and registration function
|
||||
* @param option - Optional configuration options for the provider
|
||||
*/
|
||||
setup(context: Context<Scope>, option?: Options) {
|
||||
setup(_context: Context<Scope>, option?: Options) {
|
||||
if (option) {
|
||||
this.schema.parse(option);
|
||||
}
|
||||
context;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,7 +884,7 @@ export class ConnectionOverlay extends Overlay {
|
||||
private _setupThemeListener(): void {
|
||||
const themeService = this.gfx.std.get(ThemeProvider);
|
||||
this._themeDisposer = effect(() => {
|
||||
themeService.theme$;
|
||||
void themeService.theme$.value;
|
||||
this._emphasisColor = this._getEmphasisColor();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/await-thenable */
|
||||
import type {
|
||||
Template,
|
||||
TemplateCategory,
|
||||
|
||||
@@ -9,7 +9,7 @@ import rehypeParse from 'rehype-parse';
|
||||
import { unified } from 'unified';
|
||||
|
||||
import type { AffineTextAttributes } from '../../types/index.js';
|
||||
import { HtmlDeltaConverter } from '../html/delta-converter.js';
|
||||
import type { HtmlDeltaConverter } from '../html/delta-converter.js';
|
||||
import {
|
||||
rehypeInlineToBlock,
|
||||
rehypeWrapInlineElements,
|
||||
|
||||
@@ -873,7 +873,7 @@ export class PdfAdapter extends BaseAdapter<PdfAdapterFile> {
|
||||
return {
|
||||
table: {
|
||||
headerRows: 0,
|
||||
widths: Array(sortedColumns.length).fill('*'),
|
||||
widths: Array.from({ length: sortedColumns.length }, () => '*'),
|
||||
body: tableBody,
|
||||
},
|
||||
margin: [0, 5, 0, 5],
|
||||
|
||||
@@ -115,12 +115,9 @@ export async function printToPdf(
|
||||
) as HTMLDivElement;
|
||||
|
||||
// force light theme in print iframe
|
||||
iframe.contentWindow.document.documentElement.setAttribute(
|
||||
'data-theme',
|
||||
'light'
|
||||
);
|
||||
iframe.contentWindow.document.body.setAttribute('data-theme', 'light');
|
||||
importedRoot.setAttribute('data-theme', 'light');
|
||||
iframe.contentWindow.document.documentElement.dataset.theme = 'light';
|
||||
iframe.contentWindow.document.body.dataset.theme = 'light';
|
||||
importedRoot.dataset.theme = 'light';
|
||||
|
||||
// draw saved canvas image to canvas
|
||||
const allImportedCanvas = importedRoot.getElementsByTagName('canvas');
|
||||
|
||||
@@ -126,7 +126,7 @@ export class EdgelessZoomToolbar extends WithDisposable(LitElement) {
|
||||
|
||||
this.disposables.add(
|
||||
effect(() => {
|
||||
this.gfx.tool.currentToolName$.value;
|
||||
void this.gfx.tool.currentToolName$.value;
|
||||
this.requestUpdate();
|
||||
})
|
||||
);
|
||||
|
||||
@@ -289,7 +289,7 @@ export class AffineKeyboardToolbar extends SignalWatcher(
|
||||
this.disposables.add(
|
||||
effect(() => {
|
||||
const std = this.rootComponent.std;
|
||||
std.selection.value;
|
||||
void std.selection.value;
|
||||
// wait cursor updated
|
||||
requestAnimationFrame(() => {
|
||||
this._scrollCurrentBlockIntoView();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ExtensionType, Schema, Workspace } from '@blocksuite/store';
|
||||
// @ts-ignore
|
||||
// @ts-expect-error -- mammoth.browser has no compatible type declaration for this subpath.
|
||||
import { convertToHtml } from 'mammoth/mammoth.browser';
|
||||
|
||||
import { HtmlTransformer } from './html';
|
||||
|
||||
@@ -10,12 +10,12 @@ import { Container } from '@blocksuite/global/di';
|
||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||
import { sha } from '@blocksuite/global/utils';
|
||||
import type {
|
||||
DocMeta,
|
||||
ExtensionType,
|
||||
Schema,
|
||||
Store,
|
||||
Workspace,
|
||||
} from '@blocksuite/store';
|
||||
import type { DocMeta } from '@blocksuite/store';
|
||||
import { extMimeMap, Transformer } from '@blocksuite/store';
|
||||
|
||||
import type { AssetMap, ImportedFileEntry, PathBlobIdMap } from './type.js';
|
||||
|
||||
@@ -171,9 +171,11 @@ export class Unzip {
|
||||
const fileExt =
|
||||
fileName.lastIndexOf('.') === -1 ? '' : fileName.split('.').at(-1);
|
||||
const mime = extMimeMap.get(fileExt ?? '');
|
||||
const content = new File([this.unzipped![path]], fileName, {
|
||||
type: mime ?? '',
|
||||
}) as Blob;
|
||||
const content = new File(
|
||||
[new Uint8Array(this.unzipped![path]).buffer],
|
||||
fileName,
|
||||
mime ? { type: mime } : undefined
|
||||
) as Blob;
|
||||
|
||||
const fixedPath = this.fixFileNameEncoding(path);
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ async function exportDocs(
|
||||
titleMiddleware(collection.meta.docMetas),
|
||||
],
|
||||
});
|
||||
const snapshots = await Promise.all(docs.map(job.docToSnapshot));
|
||||
|
||||
await Promise.all(
|
||||
snapshots
|
||||
docs
|
||||
.map(job.docToSnapshot)
|
||||
.filter((snapshot): snapshot is DocSnapshot => !!snapshot)
|
||||
.map(async snapshot => {
|
||||
// Use the title and id as the snapshot file name
|
||||
|
||||
@@ -190,7 +190,7 @@ export class Clipboard extends LifeCycleWatcher {
|
||||
);
|
||||
}
|
||||
return slice;
|
||||
} catch (error) {
|
||||
} catch {
|
||||
const getDataByType = this._getDataByType(data);
|
||||
const slice = await this._getSnapshotByPriority(
|
||||
type => getDataByType(type),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LifeCycleWatcher } from '../extension/index.js';
|
||||
import { BlockServiceIdentifier } from '../identifier.js';
|
||||
import { LifeCycleWatcher } from './lifecycle-watcher.js';
|
||||
|
||||
export class ServiceManager extends LifeCycleWatcher {
|
||||
static override readonly key = 'serviceManager';
|
||||
|
||||
@@ -87,6 +87,7 @@ export function batchRemoveChildren(
|
||||
}
|
||||
|
||||
uniqueElements.forEach(element => {
|
||||
// oxlint-disable-next-line unicorn/prefer-dom-node-remove
|
||||
container.removeChild(element);
|
||||
});
|
||||
}
|
||||
@@ -114,7 +115,9 @@ function traverse(
|
||||
});
|
||||
}
|
||||
|
||||
postCallBack && postCallBack(element);
|
||||
if (postCallBack) {
|
||||
postCallBack(element);
|
||||
}
|
||||
};
|
||||
|
||||
innerTraverse(element);
|
||||
|
||||
@@ -170,10 +170,10 @@ export class EditorHost extends SignalWatcher(
|
||||
...Object.values(widgetTags),
|
||||
];
|
||||
await Promise.all(
|
||||
elementsTags.map(tag => {
|
||||
elementsTags.map(async tag => {
|
||||
const element = this.renderRoot.querySelector(tag._$litStatic$);
|
||||
if (element instanceof LitElement) {
|
||||
return element.updateComplete;
|
||||
return await element.updateComplete;
|
||||
}
|
||||
return null;
|
||||
})
|
||||
|
||||
@@ -382,6 +382,7 @@ describe('addBlock', () => {
|
||||
|
||||
const doc0 = collection.createDoc('doc:home');
|
||||
const doc1 = collection.createDoc('space:doc1');
|
||||
// eslint-disable-next-line @typescript-eslint/await-thenable
|
||||
await Promise.all([doc0.load(), doc1.load()]);
|
||||
assert.equal(collection.docs.size, 2);
|
||||
const store0 = doc0.getStore({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { minimatch } from 'minimatch';
|
||||
|
||||
import { SCHEMA_NOT_FOUND_MESSAGE } from '../consts.js';
|
||||
import { BlockSchema, type BlockSchemaType } from '../model/index.js';
|
||||
import { BlockSchema, type BlockSchemaType } from '../model/block/zod.js';
|
||||
import { SchemaValidateError } from './error.js';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import {
|
||||
BlockModel,
|
||||
type DraftModel,
|
||||
type Store,
|
||||
toDraftModel,
|
||||
} from '../model/index';
|
||||
import { BlockModel } from '../model/block/block-model.js';
|
||||
import { type DraftModel, toDraftModel } from '../model/block/draft.js';
|
||||
import type { Store } from '../model/store/store.js';
|
||||
|
||||
type SliceData = {
|
||||
content: DraftModel[];
|
||||
|
||||
@@ -3,14 +3,11 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||
import { nextTick } from '@blocksuite/global/utils';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
import {
|
||||
BlockModel,
|
||||
type BlockSchemaType,
|
||||
type DraftModel,
|
||||
type Store,
|
||||
toDraftModel,
|
||||
} from '../model/index.js';
|
||||
import type { Schema } from '../schema/index.js';
|
||||
import { BlockModel } from '../model/block/block-model.js';
|
||||
import { type DraftModel, toDraftModel } from '../model/block/draft.js';
|
||||
import type { BlockSchemaType } from '../model/block/zod.js';
|
||||
import type { Store } from '../model/store/store.js';
|
||||
import type { Schema } from '../schema/schema.js';
|
||||
import { AssetsManager } from './assets.js';
|
||||
import { BaseBlockTransformer } from './base.js';
|
||||
import type {
|
||||
|
||||
Reference in New Issue
Block a user