Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config/eslint/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,16 @@ const config = defineConfig([
'@typescript-eslint/max-params': ['error', {max: 10}],
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['variable', 'property'],
format: null,
// Allow __esModule because it is a well-known interop property injected by bundlers
// (e.g. Babel/Webpack) and sometimes required by library internals (e.g. react-native-skia).
filter: {
regex: '^__esModule$',
match: true,
},
},
{
selector: ['variable', 'property'],
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
Expand Down
7 changes: 0 additions & 7 deletions jest/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ jest.mock('expo-location', () => ({

// Needed for: https://stackoverflow.com/questions/76903168/mocking-libraries-in-jest
jest.mock('react-native/Libraries/LogBox/LogBox', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: {
ignoreLogs: jest.fn(),
Expand Down Expand Up @@ -149,7 +148,6 @@ jest.mock('@libs/scheduleOnLiveMarkdownRuntime', () => {
});

jest.mock('@src/setup/telemetry', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(),
navigationIntegration: {
Expand Down Expand Up @@ -280,7 +278,6 @@ jest.mock(
);

jest.mock('@libs/prepareRequestPayload/index.native.ts', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn((command: string, data: Record<string, unknown>) => {
const formData = new FormData();
Expand All @@ -303,7 +300,6 @@ jest.mock('@libs/prepareRequestPayload/index.native.ts', () => ({
jest.mock('@components/ConfirmedRoute.tsx');

jest.mock('@src/hooks/useWorkletStateMachine/runOnUISync', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(() => jest.fn()), // Return a function that returns a function
}));
Expand Down Expand Up @@ -367,17 +363,14 @@ jest.mock('@src/components/KeyboardDismissibleFlatList/KeyboardDismissibleFlatLi
// in triggerUnreadUpdate (also timer-based), this creates excessive timer churn that causes
// heavy integration tests like SessionTest to exceed their timeout.
jest.mock('@src/hooks/useDocumentTitle', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(),
}));
jest.mock('@src/hooks/useWorkspaceDocumentTitle', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(),
}));
jest.mock('@src/hooks/useDomainDocumentTitle', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(),
}));
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function webFont(url: string): DataModule {
// a DataModule (i.e. the result of a dynamic `require()` call), which always has the shape
// `{ __esModule: true, default: <url> }`. The `__esModule` property uses a double-underscore prefix
// that violates the naming-convention rule, but it is mandated by the library's internal contract.
// eslint-disable-next-line @typescript-eslint/naming-convention
return {__esModule: true, default: url} as unknown as DataModule;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ReimbursementAccountLoadingIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function ReimbursementAccountLoadingIndicator({onBackButtonPress}: Reimbursement
return (
<ScreenWrapper
shouldShowOfflineIndicator={false}
style={[StyleSheet.absoluteFillObject, styles.reimbursementAccountFullScreenLoading]}
style={[StyleSheet.absoluteFill, styles.reimbursementAccountFullScreenLoading]}
testID="ReimbursementAccountLoadingIndicator"
>
<HeaderWithBackButton
Expand Down
1 change: 0 additions & 1 deletion tests/actions/IOUTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6764,7 +6764,6 @@ describe('actions/IOU', () => {
describe('setMoneyRequestOdometerImage and removeMoneyRequestOdometerImage', () => {
beforeEach(() => {
jest.mock('@libs/OdometerImageUtils', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(),
}));
Expand Down
2 changes: 1 addition & 1 deletion tests/navigation/LinkedActionNotFoundGuardTest.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */
import {act, render} from '@testing-library/react-native';
import React from 'react';
import {View} from 'react-native';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import type {NavigationState} from '@react-navigation/native';
import cleanStaleReportActionBackToParam from '@src/pages/inbox/cleanStaleReportActionBackToParam';

Expand Down
1 change: 0 additions & 1 deletion tests/navigation/isActiveRouteTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jest.mock('@libs/Navigation/navigationRef', () => {
};

return {
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: navigationRefMock,
};
Expand Down
2 changes: 0 additions & 2 deletions tests/perf-test/SearchRouter.perf-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ jest.mock('@src/libs/Navigation/Navigation', () => ({
}));

jest.mock('@src/hooks/useRootNavigationState', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({contextualReportID: undefined, isSearchRouterScreen: false}),
}));

jest.mock('@hooks/useExportedToFilterOptions', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({
exportedToFilterOptions: [],
Expand Down
2 changes: 0 additions & 2 deletions tests/perf-test/SelectionList.perf-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ jest.mock('@react-navigation/native', () => ({
}));

jest.mock('../../src/hooks/useKeyboardState', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(() => ({
isKeyboardShown: false,
Expand All @@ -77,7 +76,6 @@ jest.mock('../../src/hooks/useKeyboardState', () => ({
}));

jest.mock('../../src/hooks/useScreenWrapperTransitionStatus', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(() => ({
didScreenTransitionEnd: true,
Expand Down
1 change: 0 additions & 1 deletion tests/perf-test/useAdvancedSearchFilters.perf-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jest.mock('@src/libs/Navigation/Navigation', () => ({
}));

jest.mock('@hooks/useExportedToFilterOptions', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({
exportedToFilterOptions: [],
Expand Down
4 changes: 0 additions & 4 deletions tests/ui/AuthScreensInitHandlerTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,20 @@ import wrapOnyxWithWaitForBatchedUpdates from '../utils/wrapOnyxWithWaitForBatch
const TEST_ACCOUNT_ID = 1;

jest.mock('@libs/Pusher', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: {
init: jest.fn(() => Promise.resolve()),
},
}));

jest.mock('@libs/PusherConnectionManager', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: {
init: jest.fn(),
},
}));

jest.mock('@libs/Navigation/Navigation', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: {
isActiveRoute: jest.fn(() => false),
Expand All @@ -51,7 +48,6 @@ jest.mock('@libs/Navigation/Navigation', () => ({
}));

jest.mock('@libs/Navigation/currentUrl', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(() => ''),
}));
Expand Down
1 change: 0 additions & 1 deletion tests/ui/AvatarSelector.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import ONYXKEYS from '@src/ONYXKEYS';
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';

jest.mock('@hooks/useLetterAvatars', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: (name?: string) => {
if (!name) {
Expand Down
1 change: 0 additions & 1 deletion tests/ui/ChronosTimerHeaderButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention -- Mock module paths use non-standard naming conventions required by jest.mock */
import {PortalProvider} from '@gorhom/portal';
import {fireEvent, render, screen, waitFor} from '@testing-library/react-native';
import React from 'react';
Expand Down
1 change: 0 additions & 1 deletion tests/ui/FlightTripDetailsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import CONST from '@src/CONST';
import type {Reservation} from '@src/types/onyx/Transaction';

jest.mock('@hooks/useScreenWrapperTransitionStatus', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({
didScreenTransitionEnd: true,
Expand Down
1 change: 0 additions & 1 deletion tests/ui/GroupChatNameTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jest.mock('../../src/components/ConfirmedRoute.tsx');

// Needed for: https://stackoverflow.com/questions/76903168/mocking-libraries-in-jest
jest.mock('react-native/Libraries/LogBox/LogBox', () => ({
/* eslint-disable-next-line @typescript-eslint/naming-convention */
__esModule: true,
default: {
ignoreLogs: jest.fn(),
Expand Down
1 change: 0 additions & 1 deletion tests/ui/IOURequestStepDistanceTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ jest.mock('@components/DistanceRequest/DistanceRequestFooter', () => {
});

jest.mock('@hooks/useScreenWrapperTransitionStatus', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({didScreenTransitionEnd: true}),
}));
Expand Down
1 change: 0 additions & 1 deletion tests/ui/MoneyRequestReportPreview.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jest.mock('@rnmapbox/maps', () => {
const mockUseReportWithTransactionsAndViolations = jest.fn(() => defaultReportWithTransactionsAndViolations);

jest.mock('@src/hooks/useReportWithTransactionsAndViolations', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention -- __esModule is required by Jest to properly mock ES modules with default exports
__esModule: true,
default: (...args: Parameters<typeof mockUseReportWithTransactionsAndViolations>) => mockUseReportWithTransactionsAndViolations(...args),
}));
Expand Down
3 changes: 0 additions & 3 deletions tests/ui/MultifactorAuthenticationRevokePageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ let mockBiometricStatus = {
};

jest.mock('@hooks/useBiometricRegistrationStatus', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => mockBiometricStatus,
}));
Expand All @@ -37,15 +36,13 @@ jest.mock('@libs/Navigation/Navigation', () => ({
}));

jest.mock('@hooks/useLocalize', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({
translate: (key: string) => key,
}),
}));

jest.mock('@hooks/useThemeStyles', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () =>
new Proxy(
Expand Down
1 change: 0 additions & 1 deletion tests/ui/NewChatPageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import waitForBatchedUpdatesWithAct from '../utils/waitForBatchedUpdatesWithAct'
jest.mock('@react-navigation/native');
jest.mock('@src/libs/Navigation/navigationRef');
jest.mock('react-native-permissions', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
RESULTS: {
UNAVAILABLE: 'unavailable',
Expand Down
1 change: 0 additions & 1 deletion tests/ui/ParentNavigationSubtitleTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jest.mock('@libs/ReportActionsUtils', () => ({

const mockUseRootNavigationState = jest.fn();
jest.mock('@hooks/useRootNavigationState', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: (selector?: (state: unknown) => unknown) => mockUseRootNavigationState(selector) as unknown,
}));
Expand Down
1 change: 0 additions & 1 deletion tests/ui/ReservationAddressTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import HotelTripDetails from '@pages/Travel/HotelTripDetails';
import CONST from '@src/CONST';

jest.mock('@hooks/useScreenWrapperTransitionStatus', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({
didScreenTransitionEnd: true, // or false, depending on your desired behavior
Expand Down
7 changes: 0 additions & 7 deletions tests/ui/TestToolMenuBiometricsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@ let mockBiometricStatus = {
jest.mock('@hooks/useBiometricRegistrationStatus', () => {
const actual = require('@libs/MultifactorAuthentication/shared/VALUES') as {default: {REGISTRATION_STATUS: Record<string, string>}};
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => mockBiometricStatus,
REGISTRATION_STATUS: actual.default.REGISTRATION_STATUS,
};
});

jest.mock('@hooks/useIsAuthenticated', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => true,
}));

jest.mock('@hooks/useLocalize', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({
translate: (key: string, params?: Record<string, string | number>) => {
Expand All @@ -47,7 +44,6 @@ jest.mock('@hooks/useLocalize', () => ({
}));

jest.mock('@hooks/useOnyx', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => [undefined],
}));
Expand All @@ -57,13 +53,11 @@ jest.mock('@hooks/useSidebarOrderedReports', () => ({
}));

jest.mock('@hooks/useSingleExecution', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({singleExecution: (fn: () => void) => fn}),
}));

jest.mock('@hooks/useThemeStyles', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () =>
new Proxy(
Expand All @@ -75,7 +69,6 @@ jest.mock('@hooks/useThemeStyles', () => ({
}));

jest.mock('@hooks/useWaitForNavigation', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => (fn: () => void) => fn,
}));
Expand Down
1 change: 0 additions & 1 deletion tests/ui/WorkspaceMoreFeaturesPageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jest.mock('@components/Modal/ReanimatedModal', () => {
};
});

// eslint-disable-next-line @typescript-eslint/naming-convention
jest.mock('@hooks/useIsPolicyConnectedToUberReceiptPartner', () => ({__esModule: true, default: jest.fn(() => false)}));

jest.mock('@libs/CardUtils', () => {
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/components/DisplayNames.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import DisplayNames from '@components/DisplayNames';
import Parser from '@libs/Parser';

jest.mock('@libs/Parser', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: {
htmlToText: jest.fn((html: string) => html.replaceAll(/<[^>]*>/g, '')),
},
}));

jest.mock('@hooks/useLocalize', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(() => ({
translate: jest.fn((key: string) => key),
Expand Down
1 change: 0 additions & 1 deletion tests/ui/components/IOURequestStepDistanceTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ jest.mock('@react-navigation/native', () => {
});

jest.mock('@hooks/useScreenWrapperTransitionStatus', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({
didScreenTransitionEnd: true,
Expand Down
1 change: 0 additions & 1 deletion tests/ui/components/LHNOptionsListTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jest.mock('@src/languages/IntlStore', () => {
const cache = new Map<string, Record<string, unknown>>([['en', flattenObject(en)]]);

return {
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: {
getCurrentLocale: () => 'en',
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/components/PopoverMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ describe('PopoverMenu utils', () => {

jest.mock('@components/PopoverWithMeasuredContent', () => {
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: (props: PropsWithChildren<Record<string, unknown>>) => props.children,
};
Expand All @@ -151,7 +150,6 @@ jest.mock('@components/FocusableMenuItem', () => {
const {Pressable, Text} = require('react-native');

return {
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: (props: {title: string; pressableTestID?: string; onPress?: (event: GestureResponderEvent) => void}) => (
<Pressable
Expand Down
1 change: 0 additions & 1 deletion tests/ui/components/ProductTrainingContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import waitForBatchedUpdatesWithAct from '../../utils/waitForBatchedUpdatesWithA
import wrapOnyxWithWaitForBatchedUpdates from '../../utils/wrapOnyxWithWaitForBatchedUpdates';

jest.mock('@hooks/useResponsiveLayout', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: jest.fn(),
}));
Expand Down
Loading
Loading