mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 00:28:33 +00:00
fix(core): update and fix oxlint error (#13591)
#### PR Dependency Tree * **PR #13591** 👈 * **PR #13590** 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 drag-and-drop stability: draggables, drop targets, and monitors now respond when option sources or external data change. - Improved async actions and permission checks to always use the latest callbacks and error handlers. - Chores - Lint/Prettier configs updated to ignore the Git directory. - Upgraded oxlint dev dependency. - Tests - Updated several end-to-end tests for more reliable text selection, focus handling, and timing. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
**/node_modules
|
**/node_modules
|
||||||
.yarn
|
.yarn
|
||||||
.github/helm
|
.github/helm
|
||||||
|
.git
|
||||||
.vscode
|
.vscode
|
||||||
.yarnrc.yml
|
.yarnrc.yml
|
||||||
.docker
|
.docker
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"**/node_modules",
|
"**/node_modules",
|
||||||
".yarn",
|
".yarn",
|
||||||
".github/helm",
|
".github/helm",
|
||||||
|
".git",
|
||||||
".vscode",
|
".vscode",
|
||||||
".yarnrc.yml",
|
".yarnrc.yml",
|
||||||
".docker",
|
".docker",
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^16.0.0",
|
"lint-staged": "^16.0.0",
|
||||||
"msw": "^2.6.8",
|
"msw": "^2.6.8",
|
||||||
"oxlint": "^1.11.1",
|
"oxlint": "^1.15.0",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"serve": "^14.2.4",
|
"serve": "^14.2.4",
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export const useDraggable = <D extends DNDData = DNDData>(
|
|||||||
: undefined,
|
: undefined,
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [...deps, context.toExternalData]);
|
}, [...deps, getOptions, context.toExternalData]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ export const useDropTarget = <D extends DNDData = DNDData>(
|
|||||||
: undefined,
|
: undefined,
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [...deps, dropTargetContext.fromExternalData]);
|
}, [...deps, getOptions, dropTargetContext.fromExternalData]);
|
||||||
|
|
||||||
const getDropTargetOptions = useCallback(() => {
|
const getDropTargetOptions = useCallback(() => {
|
||||||
const wrappedCanDrop = dropTargetGet(options.canDrop, options);
|
const wrappedCanDrop = dropTargetGet(options.canDrop, options);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export const useDndMonitor = <D extends DNDData = DNDData>(
|
|||||||
: undefined,
|
: undefined,
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [...deps, getOptions]);
|
}, [...deps, getOptions, dropTargetContext.fromExternalData]);
|
||||||
|
|
||||||
const monitorOptions = useMemo(() => {
|
const monitorOptions = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -14,12 +14,16 @@ export const useGuard = <
|
|||||||
) => {
|
) => {
|
||||||
const guardService = useService(GuardService);
|
const guardService = useService(GuardService);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// oxlint-disable-next-line exhaustive-deps
|
||||||
guardService.revalidateCan(action, ...args);
|
guardService.revalidateCan(action, ...args);
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [action, guardService, ...args]);
|
}, [action, guardService, ...args]);
|
||||||
|
|
||||||
const livedata$ = useMemo(
|
const livedata$ = useMemo(
|
||||||
() => guardService.can$(action, ...args),
|
() => {
|
||||||
|
// oxlint-disable-next-line exhaustive-deps
|
||||||
|
return guardService.can$(action, ...args);
|
||||||
|
},
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
[action, guardService, ...args]
|
[action, guardService, ...args]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ export function useAsyncCallback<T extends any[]>(
|
|||||||
(...args: any) => {
|
(...args: any) => {
|
||||||
callback(...args).catch(e => handleAsyncError(e));
|
callback(...args).catch(e => handleAsyncError(e));
|
||||||
},
|
},
|
||||||
[...deps] // eslint-disable-line react-hooks/exhaustive-deps
|
[callback, handleAsyncError, ...deps] // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,27 +59,9 @@ test.describe('comments', () => {
|
|||||||
{ delay: 50 }
|
{ delay: 50 }
|
||||||
);
|
);
|
||||||
|
|
||||||
// Select some text using triple-click and then refine selection
|
for (let i = 0; i < 11; i++) {
|
||||||
// Triple-click to select the entire paragraph
|
await page.keyboard.press('Shift+ArrowLeft');
|
||||||
await page.locator('affine-paragraph').first().click({ clickCount: 3 });
|
}
|
||||||
|
|
||||||
// Wait for selection
|
|
||||||
await page.waitForTimeout(100);
|
|
||||||
|
|
||||||
// Now we have the whole paragraph selected, let's use mouse to select just "some text"
|
|
||||||
const paragraph = page.locator('affine-paragraph').first();
|
|
||||||
const bbox = await paragraph.boundingBox();
|
|
||||||
if (!bbox) throw new Error('Paragraph not found');
|
|
||||||
|
|
||||||
// Click and drag to select "some text" portion
|
|
||||||
// Start roughly where "some" begins (estimated position)
|
|
||||||
await page.mouse.move(bbox.x + bbox.width * 0.45, bbox.y + bbox.height / 2);
|
|
||||||
await page.mouse.down();
|
|
||||||
await page.mouse.move(bbox.x + bbox.width * 0.58, bbox.y + bbox.height / 2);
|
|
||||||
await page.mouse.up();
|
|
||||||
|
|
||||||
// Wait a bit for selection to stabilize
|
|
||||||
await page.waitForTimeout(200);
|
|
||||||
|
|
||||||
// Wait for the toolbar to appear after text selection
|
// Wait for the toolbar to appear after text selection
|
||||||
const toolbar = page.locator('editor-toolbar');
|
const toolbar = page.locator('editor-toolbar');
|
||||||
@@ -97,11 +79,14 @@ test.describe('comments', () => {
|
|||||||
await page.waitForTimeout(300); // Wait for sidebar animation
|
await page.waitForTimeout(300); // Wait for sidebar animation
|
||||||
|
|
||||||
// Find the comment editor
|
// Find the comment editor
|
||||||
const commentEditor = page.locator('.comment-editor-viewport');
|
const commentEditor = page.locator(
|
||||||
|
'.comment-editor-viewport .page-editor-container'
|
||||||
|
);
|
||||||
await expect(commentEditor).toBeVisible();
|
await expect(commentEditor).toBeVisible();
|
||||||
|
|
||||||
// Enter comment text
|
// Enter comment text
|
||||||
await commentEditor.click();
|
await commentEditor.click();
|
||||||
|
await commentEditor.focus();
|
||||||
await page.keyboard.type('This is my first comment on this text', {
|
await page.keyboard.type('This is my first comment on this text', {
|
||||||
delay: 50,
|
delay: 50,
|
||||||
});
|
});
|
||||||
@@ -125,11 +110,7 @@ test.describe('comments', () => {
|
|||||||
// The preview should show the selected text that was commented on
|
// The preview should show the selected text that was commented on
|
||||||
// Target specifically the sidebar tab content to avoid conflicts with editor content
|
// Target specifically the sidebar tab content to avoid conflicts with editor content
|
||||||
const sidebarTab = page.getByTestId('sidebar-tab-content-comment');
|
const sidebarTab = page.getByTestId('sidebar-tab-content-comment');
|
||||||
await expect(
|
await expect(sidebarTab.locator('text=comment on.')).toBeVisible();
|
||||||
sidebarTab.locator(
|
|
||||||
'text=This is a test paragraph with some text that we will comment on.'
|
|
||||||
)
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
// This text should appear in the sidebar as the preview of what was commented on
|
// This text should appear in the sidebar as the preview of what was commented on
|
||||||
|
|
||||||
|
|||||||
@@ -281,6 +281,7 @@ test('link bar should not be appear when the range is collapsed', async ({
|
|||||||
await expect(linkPopoverLocator).toBeVisible();
|
await expect(linkPopoverLocator).toBeVisible();
|
||||||
|
|
||||||
await focusRichText(page); // click to cancel the link popover
|
await focusRichText(page); // click to cancel the link popover
|
||||||
|
await waitNextFrame(page);
|
||||||
await focusRichTextEnd(page);
|
await focusRichTextEnd(page);
|
||||||
await pressShiftEnter(page);
|
await pressShiftEnter(page);
|
||||||
await waitNextFrame(page);
|
await waitNextFrame(page);
|
||||||
|
|||||||
149
yarn.lock
149
yarn.lock
@@ -803,7 +803,7 @@ __metadata:
|
|||||||
husky: "npm:^9.1.7"
|
husky: "npm:^9.1.7"
|
||||||
lint-staged: "npm:^16.0.0"
|
lint-staged: "npm:^16.0.0"
|
||||||
msw: "npm:^2.6.8"
|
msw: "npm:^2.6.8"
|
||||||
oxlint: "npm:^1.11.1"
|
oxlint: "npm:^1.15.0"
|
||||||
prettier: "npm:^3.4.2"
|
prettier: "npm:^3.4.2"
|
||||||
semver: "npm:^7.6.3"
|
semver: "npm:^7.6.3"
|
||||||
serve: "npm:^14.2.4"
|
serve: "npm:^14.2.4"
|
||||||
@@ -10698,100 +10698,58 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint-tsgolint/darwin-arm64@npm:0.0.1":
|
"@oxlint/darwin-arm64@npm:1.15.0":
|
||||||
version: 0.0.1
|
version: 1.15.0
|
||||||
resolution: "@oxlint-tsgolint/darwin-arm64@npm:0.0.1"
|
resolution: "@oxlint/darwin-arm64@npm:1.15.0"
|
||||||
conditions: os=darwin
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@oxlint-tsgolint/darwin-x64@npm:0.0.1":
|
|
||||||
version: 0.0.1
|
|
||||||
resolution: "@oxlint-tsgolint/darwin-x64@npm:0.0.1"
|
|
||||||
conditions: os=darwin
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@oxlint-tsgolint/linux-arm64@npm:0.0.1":
|
|
||||||
version: 0.0.1
|
|
||||||
resolution: "@oxlint-tsgolint/linux-arm64@npm:0.0.1"
|
|
||||||
conditions: os=linux
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@oxlint-tsgolint/linux-x64@npm:0.0.1":
|
|
||||||
version: 0.0.1
|
|
||||||
resolution: "@oxlint-tsgolint/linux-x64@npm:0.0.1"
|
|
||||||
conditions: os=linux
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@oxlint-tsgolint/win32-arm64@npm:0.0.1":
|
|
||||||
version: 0.0.1
|
|
||||||
resolution: "@oxlint-tsgolint/win32-arm64@npm:0.0.1"
|
|
||||||
conditions: os=win32
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@oxlint-tsgolint/win32-x64@npm:0.0.1":
|
|
||||||
version: 0.0.1
|
|
||||||
resolution: "@oxlint-tsgolint/win32-x64@npm:0.0.1"
|
|
||||||
conditions: os=win32
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@oxlint/darwin-arm64@npm:1.11.1":
|
|
||||||
version: 1.11.1
|
|
||||||
resolution: "@oxlint/darwin-arm64@npm:1.11.1"
|
|
||||||
conditions: os=darwin & cpu=arm64
|
conditions: os=darwin & cpu=arm64
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/darwin-x64@npm:1.11.1":
|
"@oxlint/darwin-x64@npm:1.15.0":
|
||||||
version: 1.11.1
|
version: 1.15.0
|
||||||
resolution: "@oxlint/darwin-x64@npm:1.11.1"
|
resolution: "@oxlint/darwin-x64@npm:1.15.0"
|
||||||
conditions: os=darwin & cpu=x64
|
conditions: os=darwin & cpu=x64
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/linux-arm64-gnu@npm:1.11.1":
|
"@oxlint/linux-arm64-gnu@npm:1.15.0":
|
||||||
version: 1.11.1
|
version: 1.15.0
|
||||||
resolution: "@oxlint/linux-arm64-gnu@npm:1.11.1"
|
resolution: "@oxlint/linux-arm64-gnu@npm:1.15.0"
|
||||||
conditions: os=linux & cpu=arm64 & libc=glibc
|
conditions: os=linux & cpu=arm64 & libc=glibc
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/linux-arm64-musl@npm:1.11.1":
|
"@oxlint/linux-arm64-musl@npm:1.15.0":
|
||||||
version: 1.11.1
|
version: 1.15.0
|
||||||
resolution: "@oxlint/linux-arm64-musl@npm:1.11.1"
|
resolution: "@oxlint/linux-arm64-musl@npm:1.15.0"
|
||||||
conditions: os=linux & cpu=arm64 & libc=musl
|
conditions: os=linux & cpu=arm64 & libc=musl
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/linux-x64-gnu@npm:1.11.1":
|
"@oxlint/linux-x64-gnu@npm:1.15.0":
|
||||||
version: 1.11.1
|
version: 1.15.0
|
||||||
resolution: "@oxlint/linux-x64-gnu@npm:1.11.1"
|
resolution: "@oxlint/linux-x64-gnu@npm:1.15.0"
|
||||||
conditions: os=linux & cpu=x64 & libc=glibc
|
conditions: os=linux & cpu=x64 & libc=glibc
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/linux-x64-musl@npm:1.11.1":
|
"@oxlint/linux-x64-musl@npm:1.15.0":
|
||||||
version: 1.11.1
|
version: 1.15.0
|
||||||
resolution: "@oxlint/linux-x64-musl@npm:1.11.1"
|
resolution: "@oxlint/linux-x64-musl@npm:1.15.0"
|
||||||
conditions: os=linux & cpu=x64 & libc=musl
|
conditions: os=linux & cpu=x64 & libc=musl
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/win32-arm64@npm:1.11.1":
|
"@oxlint/win32-arm64@npm:1.15.0":
|
||||||
version: 1.11.1
|
version: 1.15.0
|
||||||
resolution: "@oxlint/win32-arm64@npm:1.11.1"
|
resolution: "@oxlint/win32-arm64@npm:1.15.0"
|
||||||
conditions: os=win32 & cpu=arm64
|
conditions: os=win32 & cpu=arm64
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/win32-x64@npm:1.11.1":
|
"@oxlint/win32-x64@npm:1.15.0":
|
||||||
version: 1.11.1
|
version: 1.15.0
|
||||||
resolution: "@oxlint/win32-x64@npm:1.11.1"
|
resolution: "@oxlint/win32-x64@npm:1.15.0"
|
||||||
conditions: os=win32 & cpu=x64
|
conditions: os=win32 & cpu=x64
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
@@ -28685,48 +28643,20 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"oxlint-tsgolint@npm:>=0.0.1":
|
"oxlint@npm:^1.15.0":
|
||||||
version: 0.0.1
|
version: 1.15.0
|
||||||
resolution: "oxlint-tsgolint@npm:0.0.1"
|
resolution: "oxlint@npm:1.15.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@oxlint-tsgolint/darwin-arm64": "npm:0.0.1"
|
"@oxlint/darwin-arm64": "npm:1.15.0"
|
||||||
"@oxlint-tsgolint/darwin-x64": "npm:0.0.1"
|
"@oxlint/darwin-x64": "npm:1.15.0"
|
||||||
"@oxlint-tsgolint/linux-arm64": "npm:0.0.1"
|
"@oxlint/linux-arm64-gnu": "npm:1.15.0"
|
||||||
"@oxlint-tsgolint/linux-x64": "npm:0.0.1"
|
"@oxlint/linux-arm64-musl": "npm:1.15.0"
|
||||||
"@oxlint-tsgolint/win32-arm64": "npm:0.0.1"
|
"@oxlint/linux-x64-gnu": "npm:1.15.0"
|
||||||
"@oxlint-tsgolint/win32-x64": "npm:0.0.1"
|
"@oxlint/linux-x64-musl": "npm:1.15.0"
|
||||||
dependenciesMeta:
|
"@oxlint/win32-arm64": "npm:1.15.0"
|
||||||
"@oxlint-tsgolint/darwin-arm64":
|
"@oxlint/win32-x64": "npm:1.15.0"
|
||||||
optional: true
|
peerDependencies:
|
||||||
"@oxlint-tsgolint/darwin-x64":
|
oxlint-tsgolint: ">=0.2.0"
|
||||||
optional: true
|
|
||||||
"@oxlint-tsgolint/linux-arm64":
|
|
||||||
optional: true
|
|
||||||
"@oxlint-tsgolint/linux-x64":
|
|
||||||
optional: true
|
|
||||||
"@oxlint-tsgolint/win32-arm64":
|
|
||||||
optional: true
|
|
||||||
"@oxlint-tsgolint/win32-x64":
|
|
||||||
optional: true
|
|
||||||
bin:
|
|
||||||
tsgolint: bin/tsgolint.js
|
|
||||||
checksum: 10/2cadb04d5597f425564ed080ca608edb1014aebc85a7a9336a49285c2cb4289379f3eb614694666c8802618a28f619ab2f37dd1ac86cba33a309bc69d8ff47f1
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"oxlint@npm:^1.11.1":
|
|
||||||
version: 1.11.1
|
|
||||||
resolution: "oxlint@npm:1.11.1"
|
|
||||||
dependencies:
|
|
||||||
"@oxlint/darwin-arm64": "npm:1.11.1"
|
|
||||||
"@oxlint/darwin-x64": "npm:1.11.1"
|
|
||||||
"@oxlint/linux-arm64-gnu": "npm:1.11.1"
|
|
||||||
"@oxlint/linux-arm64-musl": "npm:1.11.1"
|
|
||||||
"@oxlint/linux-x64-gnu": "npm:1.11.1"
|
|
||||||
"@oxlint/linux-x64-musl": "npm:1.11.1"
|
|
||||||
"@oxlint/win32-arm64": "npm:1.11.1"
|
|
||||||
"@oxlint/win32-x64": "npm:1.11.1"
|
|
||||||
oxlint-tsgolint: "npm:>=0.0.1"
|
|
||||||
dependenciesMeta:
|
dependenciesMeta:
|
||||||
"@oxlint/darwin-arm64":
|
"@oxlint/darwin-arm64":
|
||||||
optional: true
|
optional: true
|
||||||
@@ -28744,12 +28674,13 @@ __metadata:
|
|||||||
optional: true
|
optional: true
|
||||||
"@oxlint/win32-x64":
|
"@oxlint/win32-x64":
|
||||||
optional: true
|
optional: true
|
||||||
|
peerDependenciesMeta:
|
||||||
oxlint-tsgolint:
|
oxlint-tsgolint:
|
||||||
optional: true
|
optional: true
|
||||||
bin:
|
bin:
|
||||||
oxc_language_server: bin/oxc_language_server
|
oxc_language_server: bin/oxc_language_server
|
||||||
oxlint: bin/oxlint
|
oxlint: bin/oxlint
|
||||||
checksum: 10/bdf6cb7f6d74b1d6c63ddfdc9597f5394857b1bbee2fb5ab6b86bae9bb58e3ca707ce345f488ae6087ffd909122b615c6020843f7669f6dade14e0396c107a9c
|
checksum: 10/1ee632ad359b3e63a3a5fccadfcab23ac4b0881b06f2e6c29431db56377858571592005459f247b2eef822d1da4c9d68afdf23965afe6ec6a5fe092f60239fa8
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user