Skip to content

Commit 07baea8

Browse files
authored
Merge pull request #89412 from Expensify/fix/esmodule-naming-convention-exception
2 parents 094dbfd + 1a97b70 commit 07baea8

80 files changed

Lines changed: 13 additions & 134 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/eslint/eslint.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ const config = defineConfig([
269269
'@typescript-eslint/max-params': ['error', {max: 10}],
270270
'@typescript-eslint/naming-convention': [
271271
'error',
272+
{
273+
selector: ['variable', 'property'],
274+
format: null,
275+
// Allow __esModule because it is a well-known interop property injected by bundlers
276+
// (e.g. Babel/Webpack) and sometimes required by library internals (e.g. react-native-skia).
277+
filter: {
278+
regex: '^__esModule$',
279+
match: true,
280+
},
281+
},
272282
{
273283
selector: ['variable', 'property'],
274284
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],

jest/setup.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ jest.mock('expo-location', () => ({
7676

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

151150
jest.mock('@src/setup/telemetry', () => ({
152-
// eslint-disable-next-line @typescript-eslint/naming-convention
153151
__esModule: true,
154152
default: jest.fn(),
155153
navigationIntegration: {
@@ -280,7 +278,6 @@ jest.mock(
280278
);
281279

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

305302
jest.mock('@src/hooks/useWorkletStateMachine/runOnUISync', () => ({
306-
// eslint-disable-next-line @typescript-eslint/naming-convention
307303
__esModule: true,
308304
default: jest.fn(() => jest.fn()), // Return a function that returns a function
309305
}));
@@ -367,17 +363,14 @@ jest.mock('@src/components/KeyboardDismissibleFlatList/KeyboardDismissibleFlatLi
367363
// in triggerUnreadUpdate (also timer-based), this creates excessive timer churn that causes
368364
// heavy integration tests like SessionTest to exceed their timeout.
369365
jest.mock('@src/hooks/useDocumentTitle', () => ({
370-
// eslint-disable-next-line @typescript-eslint/naming-convention
371366
__esModule: true,
372367
default: jest.fn(),
373368
}));
374369
jest.mock('@src/hooks/useWorkspaceDocumentTitle', () => ({
375-
// eslint-disable-next-line @typescript-eslint/naming-convention
376370
__esModule: true,
377371
default: jest.fn(),
378372
}));
379373
jest.mock('@src/hooks/useDomainDocumentTitle', () => ({
380-
// eslint-disable-next-line @typescript-eslint/naming-convention
381374
__esModule: true,
382375
default: jest.fn(),
383376
}));

src/components/Charts/hooks/useChartFontManager/useChartFontManager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ function webFont(url: string): DataModule {
66
// a DataModule (i.e. the result of a dynamic `require()` call), which always has the shape
77
// `{ __esModule: true, default: <url> }`. The `__esModule` property uses a double-underscore prefix
88
// that violates the naming-convention rule, but it is mandated by the library's internal contract.
9-
// eslint-disable-next-line @typescript-eslint/naming-convention
109
return {__esModule: true, default: url} as unknown as DataModule;
1110
}
1211

src/components/ReimbursementAccountLoadingIndicator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function ReimbursementAccountLoadingIndicator({onBackButtonPress}: Reimbursement
2121
return (
2222
<ScreenWrapper
2323
shouldShowOfflineIndicator={false}
24-
style={[StyleSheet.absoluteFillObject, styles.reimbursementAccountFullScreenLoading]}
24+
style={[StyleSheet.absoluteFill, styles.reimbursementAccountFullScreenLoading]}
2525
testID="ReimbursementAccountLoadingIndicator"
2626
>
2727
<HeaderWithBackButton

tests/actions/IOUTest.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6764,7 +6764,6 @@ describe('actions/IOU', () => {
67646764
describe('setMoneyRequestOdometerImage and removeMoneyRequestOdometerImage', () => {
67656765
beforeEach(() => {
67666766
jest.mock('@libs/OdometerImageUtils', () => ({
6767-
// eslint-disable-next-line @typescript-eslint/naming-convention
67686767
__esModule: true,
67696768
default: jest.fn(),
67706769
}));

tests/navigation/LinkedActionNotFoundGuardTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */
1+
/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */
22
import {act, render} from '@testing-library/react-native';
33
import React from 'react';
44
import {View} from 'react-native';

tests/navigation/cleanStaleReportActionBackToParamTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-unsafe-return */
1+
/* eslint-disable @typescript-eslint/no-unsafe-return */
22
import type {NavigationState} from '@react-navigation/native';
33
import cleanStaleReportActionBackToParam from '@src/pages/inbox/cleanStaleReportActionBackToParam';
44

tests/navigation/isActiveRouteTests.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jest.mock('@libs/Navigation/navigationRef', () => {
1212
};
1313

1414
return {
15-
// eslint-disable-next-line @typescript-eslint/naming-convention
1615
__esModule: true,
1716
default: navigationRefMock,
1817
};

tests/perf-test/SearchRouter.perf-test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ jest.mock('@src/libs/Navigation/Navigation', () => ({
4646
}));
4747

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

5453
jest.mock('@hooks/useExportedToFilterOptions', () => ({
55-
// eslint-disable-next-line @typescript-eslint/naming-convention
5654
__esModule: true,
5755
default: () => ({
5856
exportedToFilterOptions: [],

tests/perf-test/SelectionList.perf-test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ jest.mock('@react-navigation/native', () => ({
6868
}));
6969

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

7978
jest.mock('../../src/hooks/useScreenWrapperTransitionStatus', () => ({
80-
// eslint-disable-next-line @typescript-eslint/naming-convention
8179
__esModule: true,
8280
default: jest.fn(() => ({
8381
didScreenTransitionEnd: true,

0 commit comments

Comments
 (0)