From b3cc2bf8330aacdafa7b387deff6ccfa46a27c85 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Mon, 20 Oct 2025 21:53:10 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8(eslint)=20add=20missing=20rules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We recently upgraded to Eslint v9, it seems that it is missing some rules that we had previously. We add them back: - @typescript-eslint/no-inferrable-types - @typescript-eslint/no-floating-promises --- src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts | 6 +++--- src/frontend/apps/e2e/__tests__/app-impress/utils-editor.ts | 2 +- src/frontend/apps/e2e/__tests__/app-impress/utils-share.ts | 2 +- .../apps/e2e/__tests__/app-impress/utils-sub-pages.ts | 2 +- src/frontend/apps/impress/src/api/config.ts | 2 +- src/frontend/apps/impress/src/features/auth/conf.ts | 2 +- .../components/BlockNoteToolBar/MarkdownButton.tsx | 2 +- .../Interlinking/InterlinkingLinkInlineContent.tsx | 2 +- .../components/__tests__/DocsGridItemDate.test.tsx | 6 +++--- src/frontend/apps/impress/src/pages/docs/[id]/index.tsx | 4 +++- src/frontend/packages/eslint-plugin-docs/typescript.js | 2 ++ 11 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts b/src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts index 70e75d1c9a..fdfea08824 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts @@ -48,7 +48,7 @@ export const overrideConfig = async ( export const keyCloakSignIn = async ( page: Page, browserName: string, - fromHome: boolean = true, + fromHome = true, ) => { if (fromHome) { await page.getByRole('button', { name: 'Start Writing' }).first().click(); @@ -79,8 +79,8 @@ export const createDoc = async ( page: Page, docName: string, browserName: string, - length: number = 1, - isMobile: boolean = false, + length = 1, + isMobile = false, ) => { const randomDocs = randomName(docName, browserName, length); diff --git a/src/frontend/apps/e2e/__tests__/app-impress/utils-editor.ts b/src/frontend/apps/e2e/__tests__/app-impress/utils-editor.ts index 8bf5f106c4..4c453ab615 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/utils-editor.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/utils-editor.ts @@ -22,6 +22,6 @@ export const writeInEditor = async ({ text: string; }) => { const editor = await getEditor({ page }); - editor.locator('.bn-block-outer').last().fill(text); + await editor.locator('.bn-block-outer').last().fill(text); return editor; }; diff --git a/src/frontend/apps/e2e/__tests__/app-impress/utils-share.ts b/src/frontend/apps/e2e/__tests__/app-impress/utils-share.ts index 3adfd034de..030d8251a6 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/utils-share.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/utils-share.ts @@ -15,7 +15,7 @@ export const addNewMember = async ( page: Page, index: number, role: 'Administrator' | 'Owner' | 'Editor' | 'Reader', - fillText: string = 'user.test', + fillText = 'user.test', ) => { const responsePromiseSearchUser = page.waitForResponse( (response) => diff --git a/src/frontend/apps/e2e/__tests__/app-impress/utils-sub-pages.ts b/src/frontend/apps/e2e/__tests__/app-impress/utils-sub-pages.ts index a5eb02d8a7..236b455ecd 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/utils-sub-pages.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/utils-sub-pages.ts @@ -12,7 +12,7 @@ export const createRootSubPage = async ( page: Page, browserName: BrowserName, docName: string, - isMobile: boolean = false, + isMobile = false, ) => { if (isMobile) { await page diff --git a/src/frontend/apps/impress/src/api/config.ts b/src/frontend/apps/impress/src/api/config.ts index 916585e60f..946b7c9d03 100644 --- a/src/frontend/apps/impress/src/api/config.ts +++ b/src/frontend/apps/impress/src/api/config.ts @@ -18,5 +18,5 @@ export const backendUrl = () => * @param apiVersion - The version of the API (defaults to '1.0'). * @returns The full versioned API base URL as a string. */ -export const baseApiUrl = (apiVersion: string = '1.0') => +export const baseApiUrl = (apiVersion = '1.0') => `${backendUrl()}/api/v${apiVersion}/`; diff --git a/src/frontend/apps/impress/src/features/auth/conf.ts b/src/frontend/apps/impress/src/features/auth/conf.ts index 14bb1d225f..c44fe01884 100644 --- a/src/frontend/apps/impress/src/features/auth/conf.ts +++ b/src/frontend/apps/impress/src/features/auth/conf.ts @@ -1,6 +1,6 @@ import { baseApiUrl } from '@/api'; -export const HOME_URL: string = '/home'; +export const HOME_URL = '/home'; export const LOGIN_URL = `${baseApiUrl()}authenticate/`; export const LOGOUT_URL = `${baseApiUrl()}logout/`; export const PATH_AUTH_LOCAL_STORAGE = 'docs-path-auth'; diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolBar/MarkdownButton.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolBar/MarkdownButton.tsx index 3589562121..75a7965d09 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolBar/MarkdownButton.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolBar/MarkdownButton.tsx @@ -22,7 +22,7 @@ function isBlock(block: Block): block is Block { ); } -const recursiveContent = (content: Block[], base: string = '') => { +const recursiveContent = (content: Block[], base = '') => { let fullContent = base; for (const innerContent of content) { if (innerContent.type === 'text') { diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx index 599d9808af..92e856fc71 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx @@ -56,7 +56,7 @@ const LinkSelected = ({ url, title }: LinkSelectedProps) => { const handleClick = (e: React.MouseEvent) => { e.preventDefault(); - router.push(url); + void router.push(url); }; return ( diff --git a/src/frontend/apps/impress/src/features/docs/docs-grid/components/__tests__/DocsGridItemDate.test.tsx b/src/frontend/apps/impress/src/features/docs/docs-grid/components/__tests__/DocsGridItemDate.test.tsx index 7859f1b3f1..524e98cf0c 100644 --- a/src/frontend/apps/impress/src/features/docs/docs-grid/components/__tests__/DocsGridItemDate.test.tsx +++ b/src/frontend/apps/impress/src/features/docs/docs-grid/components/__tests__/DocsGridItemDate.test.tsx @@ -64,8 +64,8 @@ describe('DocsGridItemDate', () => { }); }); - it(`should render rendered the updated_at field in the correct language`, () => { - i18next.changeLanguage('fr'); + it(`should render rendered the updated_at field in the correct language`, async () => { + await i18next.changeLanguage('fr'); render( { expect(screen.getByRole('link')).toBeInTheDocument(); expect(screen.getByText('il y a 5 jours')).toBeInTheDocument(); - i18next.changeLanguage('en'); + await i18next.changeLanguage('en'); }); [ diff --git a/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx b/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx index e18ea817a9..d2ef5e8b5f 100644 --- a/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx +++ b/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx @@ -115,7 +115,9 @@ const DocPage = ({ id }: DocProps) => { // Invalidate when provider store reports a lost connection useEffect(() => { if (hasLostConnection && doc?.id) { - queryClient.invalidateQueries({ queryKey: [KEY_DOC, { id: doc.id }] }); + void queryClient.invalidateQueries({ + queryKey: [KEY_DOC, { id: doc.id }], + }); resetLostConnection(); } }, [hasLostConnection, doc?.id, queryClient, resetLostConnection]); diff --git a/src/frontend/packages/eslint-plugin-docs/typescript.js b/src/frontend/packages/eslint-plugin-docs/typescript.js index 7d98f9f707..c28f058b1a 100644 --- a/src/frontend/packages/eslint-plugin-docs/typescript.js +++ b/src/frontend/packages/eslint-plugin-docs/typescript.js @@ -22,7 +22,9 @@ const typescriptConfig = { '@typescript-eslint': typescriptEslint, }, rules: { + '@typescript-eslint/no-inferrable-types': 'error', '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/no-non-null-assertion': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-unsafe-argument': 'error',