diff --git a/eslint.config.mjs b/eslint.config.mjs index aa94178c..481e88af 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -61,10 +61,15 @@ export default tseslint.config( '@typescript-eslint/no-unsafe-call': 'off', '@typescript-eslint/no-unsafe-return': 'off', '@typescript-eslint/no-unsafe-enum-comparison': 'off', - '@typescript-eslint/no-unnecessary-type-assertion': 'off', - '@typescript-eslint/no-redundant-type-constituents': 'off', + }, + }, + { + // Test files: `async` test callbacks and `act(async () => {})` wrappers are + // idiomatic even when they contain no `await` (async `act` flushes the + // microtask queue). Relaxing require-await here avoids churn in test infra. + files: ['**/*.spec.{ts,tsx}', '**/*.test.{ts,tsx}'], + rules: { '@typescript-eslint/require-await': 'off', - '@typescript-eslint/no-misused-promises': 'off', }, }, prettierRecommended, diff --git a/src/app/[locale]/account/notifications/AccountNotifications.tsx b/src/app/[locale]/account/notifications/AccountNotifications.tsx index 499a05c6..79dd909c 100644 --- a/src/app/[locale]/account/notifications/AccountNotifications.tsx +++ b/src/app/[locale]/account/notifications/AccountNotifications.tsx @@ -315,9 +315,7 @@ export default function AccountNotifications(): React.ReactElement { { - setFrequency( - e.target.value as NotificationSettings['frequency'], - ); + setFrequency(e.target.value); }} size='small' > diff --git a/src/app/screens/FeedSubmitted.tsx b/src/app/screens/FeedSubmitted.tsx index 6cfa7427..8e265c63 100644 --- a/src/app/screens/FeedSubmitted.tsx +++ b/src/app/screens/FeedSubmitted.tsx @@ -1,6 +1,7 @@ 'use client'; import { Typography, Box, Container, useTheme, Button } from '@mui/material'; +import Image from 'next/image'; export default function FeedSubmitted(): React.ReactElement { const theme = useTheme(); @@ -21,10 +22,13 @@ export default function FeedSubmitted(): React.ReactElement { 🚀 Your feed has been submitted! - rocket diff --git a/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx b/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx index 3fa621d3..cb821691 100644 --- a/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx +++ b/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx @@ -37,7 +37,7 @@ export default function GbfsFeedSearchInput({ initialFeedUrl ?? '', ); const [requiresAuth, setRequiresAuth] = useState(false); - const [authType, setAuthType] = useState(''); + const [authType, setAuthType] = useState(''); const [basicAuthUsername, setBasicAuthUsername] = useState< string | undefined >(undefined); @@ -65,7 +65,9 @@ export default function GbfsFeedSearchInput({ // Used to keep the auth inputs up to date useEffect(() => { setRequiresAuth(auth !== undefined); - setAuthType(auth == undefined ? '' : (auth.authType ?? '')); + setAuthType( + auth == undefined ? '' : ((auth.authType as AuthTypeEnum) ?? ''), + ); setBasicAuthUsername( auth != null && 'username' in auth ? auth.username : undefined, ); @@ -91,7 +93,7 @@ export default function GbfsFeedSearchInput({ }; const handleAuthTypeChange = (event: SelectChangeEvent): void => { - setAuthType(event.target.value); + setAuthType(event.target.value as AuthTypeEnum); setBasicAuthUsername(undefined); setBasicAuthPassword(undefined); setBearerAuthValue(undefined); diff --git a/src/app/screens/GbfsValidator/components/ErrorDetailsDialog.tsx b/src/app/screens/GbfsValidator/components/ErrorDetailsDialog.tsx index e045892e..de866a11 100644 --- a/src/app/screens/GbfsValidator/components/ErrorDetailsDialog.tsx +++ b/src/app/screens/GbfsValidator/components/ErrorDetailsDialog.tsx @@ -431,7 +431,7 @@ export function ErrorDetailsDialog({ )} {renderHighlightedObject( - parentContextData as JSONValue, + parentContextData, null, null, )} @@ -439,7 +439,7 @@ export function ErrorDetailsDialog({ ); } return renderHighlightedObject( - parentContextData as JSONValue, + parentContextData, lastPointerSegment ?? null, lastArrayIndex, ); diff --git a/src/app/services/api-auth-middleware.ts b/src/app/services/api-auth-middleware.ts index d83ba77b..1f30c393 100644 --- a/src/app/services/api-auth-middleware.ts +++ b/src/app/services/api-auth-middleware.ts @@ -25,7 +25,7 @@ export const generateAuthMiddlewareWithToken = ( userContextJwt?: string, ): Middleware => { return { - async onRequest(req) { + onRequest(req) { // Always attach the bearer token for IAP/GCIP. req.headers.set('Authorization', `Bearer ${accessToken}`); diff --git a/src/app/services/profile-service.ts b/src/app/services/profile-service.ts index 1835d51f..481c32b1 100644 --- a/src/app/services/profile-service.ts +++ b/src/app/services/profile-service.ts @@ -22,7 +22,7 @@ export const sendEmailVerification = async (): Promise => { /** * Return the current user or null if the user is not logged in. */ -export const getUserFromSession = async (): Promise => { +export const getUserFromSession = (): User | null => { const currentUser = app.auth().currentUser; if (currentUser === null) { return null; diff --git a/src/app/types.ts b/src/app/types.ts index 5c196f87..a6560598 100644 --- a/src/app/types.ts +++ b/src/app/types.ts @@ -78,19 +78,19 @@ export enum LicenseErrorSource { } export interface ProfileError { - code: string | 'unknown'; + code: string; message: string; source?: ProfileErrorSource; } export interface FeedError { - code: string | 'unknown'; + code: string; message: string; source?: FeedErrorSource; } export interface LicenseError { - code: string | 'unknown'; + code: string; message: string; source?: LicenseErrorSource; } diff --git a/src/app/utils/precompute.ts b/src/app/utils/precompute.ts index 62bce45e..83490aad 100644 --- a/src/app/utils/precompute.ts +++ b/src/app/utils/precompute.ts @@ -42,13 +42,7 @@ export interface PrecomputeDeps { /** Small helper: wait once for a map event */ async function once(map: maplibregl.Map, ev: string): Promise { - await new Promise( - // eslint-disable-next-line no-async-promise-executor - async (resolve) => - await map.once(ev, () => { - resolve(); - }), - ); + await map.once(ev); } // Extend helpers for [minLng,minLat,maxLng,maxLat]