🚨(eslint) add missing rules

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
This commit is contained in:
Anthony LC
2025-10-20 21:53:10 +02:00
parent 18feab10cb
commit b3cc2bf833
11 changed files with 18 additions and 14 deletions

View File

@@ -48,7 +48,7 @@ export const overrideConfig = async (
export const keyCloakSignIn = async ( export const keyCloakSignIn = async (
page: Page, page: Page,
browserName: string, browserName: string,
fromHome: boolean = true, fromHome = true,
) => { ) => {
if (fromHome) { if (fromHome) {
await page.getByRole('button', { name: 'Start Writing' }).first().click(); await page.getByRole('button', { name: 'Start Writing' }).first().click();
@@ -79,8 +79,8 @@ export const createDoc = async (
page: Page, page: Page,
docName: string, docName: string,
browserName: string, browserName: string,
length: number = 1, length = 1,
isMobile: boolean = false, isMobile = false,
) => { ) => {
const randomDocs = randomName(docName, browserName, length); const randomDocs = randomName(docName, browserName, length);

View File

@@ -22,6 +22,6 @@ export const writeInEditor = async ({
text: string; text: string;
}) => { }) => {
const editor = await getEditor({ page }); const editor = await getEditor({ page });
editor.locator('.bn-block-outer').last().fill(text); await editor.locator('.bn-block-outer').last().fill(text);
return editor; return editor;
}; };

View File

@@ -15,7 +15,7 @@ export const addNewMember = async (
page: Page, page: Page,
index: number, index: number,
role: 'Administrator' | 'Owner' | 'Editor' | 'Reader', role: 'Administrator' | 'Owner' | 'Editor' | 'Reader',
fillText: string = 'user.test', fillText = 'user.test',
) => { ) => {
const responsePromiseSearchUser = page.waitForResponse( const responsePromiseSearchUser = page.waitForResponse(
(response) => (response) =>

View File

@@ -12,7 +12,7 @@ export const createRootSubPage = async (
page: Page, page: Page,
browserName: BrowserName, browserName: BrowserName,
docName: string, docName: string,
isMobile: boolean = false, isMobile = false,
) => { ) => {
if (isMobile) { if (isMobile) {
await page await page

View File

@@ -18,5 +18,5 @@ export const backendUrl = () =>
* @param apiVersion - The version of the API (defaults to '1.0'). * @param apiVersion - The version of the API (defaults to '1.0').
* @returns The full versioned API base URL as a string. * @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}/`; `${backendUrl()}/api/v${apiVersion}/`;

View File

@@ -1,6 +1,6 @@
import { baseApiUrl } from '@/api'; import { baseApiUrl } from '@/api';
export const HOME_URL: string = '/home'; export const HOME_URL = '/home';
export const LOGIN_URL = `${baseApiUrl()}authenticate/`; export const LOGIN_URL = `${baseApiUrl()}authenticate/`;
export const LOGOUT_URL = `${baseApiUrl()}logout/`; export const LOGOUT_URL = `${baseApiUrl()}logout/`;
export const PATH_AUTH_LOCAL_STORAGE = 'docs-path-auth'; export const PATH_AUTH_LOCAL_STORAGE = 'docs-path-auth';

View File

@@ -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; let fullContent = base;
for (const innerContent of content) { for (const innerContent of content) {
if (innerContent.type === 'text') { if (innerContent.type === 'text') {

View File

@@ -56,7 +56,7 @@ const LinkSelected = ({ url, title }: LinkSelectedProps) => {
const handleClick = (e: React.MouseEvent<HTMLDivElement>) => { const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
e.preventDefault(); e.preventDefault();
router.push(url); void router.push(url);
}; };
return ( return (

View File

@@ -64,8 +64,8 @@ describe('DocsGridItemDate', () => {
}); });
}); });
it(`should render rendered the updated_at field in the correct language`, () => { it(`should render rendered the updated_at field in the correct language`, async () => {
i18next.changeLanguage('fr'); await i18next.changeLanguage('fr');
render( render(
<DocsGridItemDate <DocsGridItemDate
@@ -83,7 +83,7 @@ describe('DocsGridItemDate', () => {
expect(screen.getByRole('link')).toBeInTheDocument(); expect(screen.getByRole('link')).toBeInTheDocument();
expect(screen.getByText('il y a 5 jours')).toBeInTheDocument(); expect(screen.getByText('il y a 5 jours')).toBeInTheDocument();
i18next.changeLanguage('en'); await i18next.changeLanguage('en');
}); });
[ [

View File

@@ -115,7 +115,9 @@ const DocPage = ({ id }: DocProps) => {
// Invalidate when provider store reports a lost connection // Invalidate when provider store reports a lost connection
useEffect(() => { useEffect(() => {
if (hasLostConnection && doc?.id) { if (hasLostConnection && doc?.id) {
queryClient.invalidateQueries({ queryKey: [KEY_DOC, { id: doc.id }] }); void queryClient.invalidateQueries({
queryKey: [KEY_DOC, { id: doc.id }],
});
resetLostConnection(); resetLostConnection();
} }
}, [hasLostConnection, doc?.id, queryClient, resetLostConnection]); }, [hasLostConnection, doc?.id, queryClient, resetLostConnection]);

View File

@@ -22,7 +22,9 @@ const typescriptConfig = {
'@typescript-eslint': typescriptEslint, '@typescript-eslint': typescriptEslint,
}, },
rules: { rules: {
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-non-null-assertion': 'error', '@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unsafe-argument': 'error', '@typescript-eslint/no-unsafe-argument': 'error',