diff --git a/.prettierignore b/.prettierignore index 5cbdefea1b..38a1ef6845 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,6 +2,7 @@ **/node_modules .yarn .github/helm +.git .vscode .yarnrc.yml .docker diff --git a/oxlint.json b/oxlint.json index 261fff18d0..2145806bc1 100644 --- a/oxlint.json +++ b/oxlint.json @@ -9,6 +9,7 @@ "**/node_modules", ".yarn", ".github/helm", + ".git", ".vscode", ".yarnrc.yml", ".docker", diff --git a/package.json b/package.json index ddb3f0c8be..34fa8995cb 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "husky": "^9.1.7", "lint-staged": "^16.0.0", "msw": "^2.6.8", - "oxlint": "^1.11.1", + "oxlint": "^1.15.0", "prettier": "^3.4.2", "semver": "^7.6.3", "serve": "^14.2.4", diff --git a/packages/frontend/component/src/ui/dnd/draggable.ts b/packages/frontend/component/src/ui/dnd/draggable.ts index 1bb1022c5c..354f60afcd 100644 --- a/packages/frontend/component/src/ui/dnd/draggable.ts +++ b/packages/frontend/component/src/ui/dnd/draggable.ts @@ -84,7 +84,7 @@ export const useDraggable = ( : undefined, }; // eslint-disable-next-line react-hooks/exhaustive-deps - }, [...deps, context.toExternalData]); + }, [...deps, getOptions, context.toExternalData]); useEffect(() => { if ( diff --git a/packages/frontend/component/src/ui/dnd/drop-target.ts b/packages/frontend/component/src/ui/dnd/drop-target.ts index 66831f8e1d..0a4e3d5b47 100644 --- a/packages/frontend/component/src/ui/dnd/drop-target.ts +++ b/packages/frontend/component/src/ui/dnd/drop-target.ts @@ -207,7 +207,7 @@ export const useDropTarget = ( : undefined, }; // eslint-disable-next-line react-hooks/exhaustive-deps - }, [...deps, dropTargetContext.fromExternalData]); + }, [...deps, getOptions, dropTargetContext.fromExternalData]); const getDropTargetOptions = useCallback(() => { const wrappedCanDrop = dropTargetGet(options.canDrop, options); diff --git a/packages/frontend/component/src/ui/dnd/monitor.tsx b/packages/frontend/component/src/ui/dnd/monitor.tsx index 852708a454..1a0d618ff0 100644 --- a/packages/frontend/component/src/ui/dnd/monitor.tsx +++ b/packages/frontend/component/src/ui/dnd/monitor.tsx @@ -95,7 +95,7 @@ export const useDndMonitor = ( : undefined, }; // eslint-disable-next-line react-hooks/exhaustive-deps - }, [...deps, getOptions]); + }, [...deps, getOptions, dropTargetContext.fromExternalData]); const monitorOptions = useMemo(() => { return { diff --git a/packages/frontend/core/src/components/guard/use-guard.tsx b/packages/frontend/core/src/components/guard/use-guard.tsx index 9f0e779b0f..ff67c339b2 100644 --- a/packages/frontend/core/src/components/guard/use-guard.tsx +++ b/packages/frontend/core/src/components/guard/use-guard.tsx @@ -14,12 +14,16 @@ export const useGuard = < ) => { const guardService = useService(GuardService); useEffect(() => { + // oxlint-disable-next-line exhaustive-deps guardService.revalidateCan(action, ...args); // eslint-disable-next-line react-hooks/exhaustive-deps }, [action, guardService, ...args]); 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 [action, guardService, ...args] ); diff --git a/packages/frontend/core/src/components/hooks/affine-async-hooks.ts b/packages/frontend/core/src/components/hooks/affine-async-hooks.ts index c1d9679fcf..ae1daeb540 100644 --- a/packages/frontend/core/src/components/hooks/affine-async-hooks.ts +++ b/packages/frontend/core/src/components/hooks/affine-async-hooks.ts @@ -24,6 +24,6 @@ export function useAsyncCallback( (...args: any) => { callback(...args).catch(e => handleAsyncError(e)); }, - [...deps] // eslint-disable-line react-hooks/exhaustive-deps + [callback, handleAsyncError, ...deps] // eslint-disable-line react-hooks/exhaustive-deps ); } diff --git a/tests/affine-cloud/e2e/comments.spec.ts b/tests/affine-cloud/e2e/comments.spec.ts index fab743d251..82ae0177e8 100644 --- a/tests/affine-cloud/e2e/comments.spec.ts +++ b/tests/affine-cloud/e2e/comments.spec.ts @@ -59,27 +59,9 @@ test.describe('comments', () => { { delay: 50 } ); - // Select some text using triple-click and then refine selection - // Triple-click to select the entire paragraph - 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); + for (let i = 0; i < 11; i++) { + await page.keyboard.press('Shift+ArrowLeft'); + } // Wait for the toolbar to appear after text selection const toolbar = page.locator('editor-toolbar'); @@ -97,11 +79,14 @@ test.describe('comments', () => { await page.waitForTimeout(300); // Wait for sidebar animation // 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(); // Enter comment text await commentEditor.click(); + await commentEditor.focus(); await page.keyboard.type('This is my first comment on this text', { delay: 50, }); @@ -125,11 +110,7 @@ test.describe('comments', () => { // The preview should show the selected text that was commented on // Target specifically the sidebar tab content to avoid conflicts with editor content const sidebarTab = page.getByTestId('sidebar-tab-content-comment'); - await expect( - sidebarTab.locator( - 'text=This is a test paragraph with some text that we will comment on.' - ) - ).toBeVisible(); + await expect(sidebarTab.locator('text=comment on.')).toBeVisible(); // This text should appear in the sidebar as the preview of what was commented on diff --git a/tests/blocksuite/e2e/link.spec.ts b/tests/blocksuite/e2e/link.spec.ts index cc113d8571..348344d9ee 100644 --- a/tests/blocksuite/e2e/link.spec.ts +++ b/tests/blocksuite/e2e/link.spec.ts @@ -281,6 +281,7 @@ test('link bar should not be appear when the range is collapsed', async ({ await expect(linkPopoverLocator).toBeVisible(); await focusRichText(page); // click to cancel the link popover + await waitNextFrame(page); await focusRichTextEnd(page); await pressShiftEnter(page); await waitNextFrame(page); diff --git a/yarn.lock b/yarn.lock index cdb16bf92f..b85ea49dfc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -803,7 +803,7 @@ __metadata: husky: "npm:^9.1.7" lint-staged: "npm:^16.0.0" msw: "npm:^2.6.8" - oxlint: "npm:^1.11.1" + oxlint: "npm:^1.15.0" prettier: "npm:^3.4.2" semver: "npm:^7.6.3" serve: "npm:^14.2.4" @@ -10698,100 +10698,58 @@ __metadata: languageName: node linkType: hard -"@oxlint-tsgolint/darwin-arm64@npm:0.0.1": - version: 0.0.1 - resolution: "@oxlint-tsgolint/darwin-arm64@npm:0.0.1" - 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" +"@oxlint/darwin-arm64@npm:1.15.0": + version: 1.15.0 + resolution: "@oxlint/darwin-arm64@npm:1.15.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@oxlint/darwin-x64@npm:1.11.1": - version: 1.11.1 - resolution: "@oxlint/darwin-x64@npm:1.11.1" +"@oxlint/darwin-x64@npm:1.15.0": + version: 1.15.0 + resolution: "@oxlint/darwin-x64@npm:1.15.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@oxlint/linux-arm64-gnu@npm:1.11.1": - version: 1.11.1 - resolution: "@oxlint/linux-arm64-gnu@npm:1.11.1" +"@oxlint/linux-arm64-gnu@npm:1.15.0": + version: 1.15.0 + resolution: "@oxlint/linux-arm64-gnu@npm:1.15.0" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@oxlint/linux-arm64-musl@npm:1.11.1": - version: 1.11.1 - resolution: "@oxlint/linux-arm64-musl@npm:1.11.1" +"@oxlint/linux-arm64-musl@npm:1.15.0": + version: 1.15.0 + resolution: "@oxlint/linux-arm64-musl@npm:1.15.0" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@oxlint/linux-x64-gnu@npm:1.11.1": - version: 1.11.1 - resolution: "@oxlint/linux-x64-gnu@npm:1.11.1" +"@oxlint/linux-x64-gnu@npm:1.15.0": + version: 1.15.0 + resolution: "@oxlint/linux-x64-gnu@npm:1.15.0" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@oxlint/linux-x64-musl@npm:1.11.1": - version: 1.11.1 - resolution: "@oxlint/linux-x64-musl@npm:1.11.1" +"@oxlint/linux-x64-musl@npm:1.15.0": + version: 1.15.0 + resolution: "@oxlint/linux-x64-musl@npm:1.15.0" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@oxlint/win32-arm64@npm:1.11.1": - version: 1.11.1 - resolution: "@oxlint/win32-arm64@npm:1.11.1" +"@oxlint/win32-arm64@npm:1.15.0": + version: 1.15.0 + resolution: "@oxlint/win32-arm64@npm:1.15.0" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@oxlint/win32-x64@npm:1.11.1": - version: 1.11.1 - resolution: "@oxlint/win32-x64@npm:1.11.1" +"@oxlint/win32-x64@npm:1.15.0": + version: 1.15.0 + resolution: "@oxlint/win32-x64@npm:1.15.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -28685,48 +28643,20 @@ __metadata: languageName: node linkType: hard -"oxlint-tsgolint@npm:>=0.0.1": - version: 0.0.1 - resolution: "oxlint-tsgolint@npm:0.0.1" +"oxlint@npm:^1.15.0": + version: 1.15.0 + resolution: "oxlint@npm:1.15.0" dependencies: - "@oxlint-tsgolint/darwin-arm64": "npm:0.0.1" - "@oxlint-tsgolint/darwin-x64": "npm:0.0.1" - "@oxlint-tsgolint/linux-arm64": "npm:0.0.1" - "@oxlint-tsgolint/linux-x64": "npm:0.0.1" - "@oxlint-tsgolint/win32-arm64": "npm:0.0.1" - "@oxlint-tsgolint/win32-x64": "npm:0.0.1" - dependenciesMeta: - "@oxlint-tsgolint/darwin-arm64": - optional: true - "@oxlint-tsgolint/darwin-x64": - 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" + "@oxlint/darwin-arm64": "npm:1.15.0" + "@oxlint/darwin-x64": "npm:1.15.0" + "@oxlint/linux-arm64-gnu": "npm:1.15.0" + "@oxlint/linux-arm64-musl": "npm:1.15.0" + "@oxlint/linux-x64-gnu": "npm:1.15.0" + "@oxlint/linux-x64-musl": "npm:1.15.0" + "@oxlint/win32-arm64": "npm:1.15.0" + "@oxlint/win32-x64": "npm:1.15.0" + peerDependencies: + oxlint-tsgolint: ">=0.2.0" dependenciesMeta: "@oxlint/darwin-arm64": optional: true @@ -28744,12 +28674,13 @@ __metadata: optional: true "@oxlint/win32-x64": optional: true + peerDependenciesMeta: oxlint-tsgolint: optional: true bin: oxc_language_server: bin/oxc_language_server oxlint: bin/oxlint - checksum: 10/bdf6cb7f6d74b1d6c63ddfdc9597f5394857b1bbee2fb5ab6b86bae9bb58e3ca707ce345f488ae6087ffd909122b615c6020843f7669f6dade14e0396c107a9c + checksum: 10/1ee632ad359b3e63a3a5fccadfcab23ac4b0881b06f2e6c29431db56377858571592005459f247b2eef822d1da4c9d68afdf23965afe6ec6a5fe092f60239fa8 languageName: node linkType: hard