diff --git a/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts b/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts index b27b08942b18a..fbe9c94438818 100644 --- a/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts +++ b/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts @@ -54,6 +54,7 @@ function detectReactComponent(code: string, filename: string): boolean | undefin } if (path.isFunctionDeclaration() || path.isArrowFunctionExpression() || path.isFunctionExpression()) { path.traverse({ + // eslint-disable-next-line @typescript-eslint/naming-convention JSXElement() { isReactComponent = true; path.stop(); @@ -61,6 +62,7 @@ function detectReactComponent(code: string, filename: string): boolean | undefin }); } }, + // eslint-disable-next-line @typescript-eslint/naming-convention ClassDeclaration(path) { const {superClass} = path.node as unknown as SuperClassType; if ( diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 5b01c3f42ac33..f207a49f0d55c 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -15501,6 +15501,7 @@ function detectReactComponent(code, filename) { } if (path.isFunctionDeclaration() || path.isArrowFunctionExpression() || path.isFunctionExpression()) { path.traverse({ + // eslint-disable-next-line @typescript-eslint/naming-convention JSXElement() { isReactComponent = true; path.stop(); @@ -15508,6 +15509,7 @@ function detectReactComponent(code, filename) { }); } }, + // eslint-disable-next-line @typescript-eslint/naming-convention ClassDeclaration(path) { const { superClass } = path.node; if (superClass && @@ -15677,7 +15679,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/awaitStagingDeploys/index.js b/.github/actions/javascript/awaitStagingDeploys/index.js index bf1b40d88f132..c655339397f88 100644 --- a/.github/actions/javascript/awaitStagingDeploys/index.js +++ b/.github/actions/javascript/awaitStagingDeploys/index.js @@ -12457,7 +12457,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/bumpVersion/index.js b/.github/actions/javascript/bumpVersion/index.js index c64afea553537..3c63788633338 100644 --- a/.github/actions/javascript/bumpVersion/index.js +++ b/.github/actions/javascript/bumpVersion/index.js @@ -3600,6 +3600,7 @@ const patch_1 = __importDefault(__nccwpck_require__(2866)); const prerelease_1 = __importDefault(__nccwpck_require__(4016)); const util_1 = __nccwpck_require__(3837); // Disabling lint on the next two imports due to a bug in @dword-design/import-alias/prefer-alias +// eslint-disable-next-line const versionUpdater = __importStar(__nccwpck_require__(8982)); const exec = (0, util_1.promisify)(child_process_1.exec); // PlistBuddy executable path diff --git a/.github/actions/javascript/checkAndroidStatus/index.js b/.github/actions/javascript/checkAndroidStatus/index.js index 35eb3d5428861..43973e398085f 100644 --- a/.github/actions/javascript/checkAndroidStatus/index.js +++ b/.github/actions/javascript/checkAndroidStatus/index.js @@ -737200,7 +737200,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(42186)); const utils_1 = __nccwpck_require__(73030); const plugin_paginate_rest_1 = __nccwpck_require__(64193); diff --git a/.github/actions/javascript/checkDeployBlockers/index.js b/.github/actions/javascript/checkDeployBlockers/index.js index 4af54e639bb1b..4f9879646d9e1 100644 --- a/.github/actions/javascript/checkDeployBlockers/index.js +++ b/.github/actions/javascript/checkDeployBlockers/index.js @@ -11724,7 +11724,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/checkSVGCompression/index.js b/.github/actions/javascript/checkSVGCompression/index.js index 460d7e660b63f..08035a5a2ea1d 100644 --- a/.github/actions/javascript/checkSVGCompression/index.js +++ b/.github/actions/javascript/checkSVGCompression/index.js @@ -20249,7 +20249,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/formatCodeCovComment/index.js b/.github/actions/javascript/formatCodeCovComment/index.js index 78d67e9dddab1..f2dee5c3d4b50 100644 --- a/.github/actions/javascript/formatCodeCovComment/index.js +++ b/.github/actions/javascript/formatCodeCovComment/index.js @@ -11911,7 +11911,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/getArtifactInfo/index.js b/.github/actions/javascript/getArtifactInfo/index.js index 99438d2e4fc5b..ba1dafc205bba 100644 --- a/.github/actions/javascript/getArtifactInfo/index.js +++ b/.github/actions/javascript/getArtifactInfo/index.js @@ -11685,7 +11685,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index 229efcb441f61..a20dce0f925bd 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -12066,7 +12066,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/getPreviousVersion/index.js b/.github/actions/javascript/getPreviousVersion/index.js index 4c066d31d2f58..b68d608b4e342 100644 --- a/.github/actions/javascript/getPreviousVersion/index.js +++ b/.github/actions/javascript/getPreviousVersion/index.js @@ -11877,7 +11877,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 76f58d07c4366..ba050da3e984d 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -11814,7 +11814,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/getPullRequestIncrementalChanges/index.js b/.github/actions/javascript/getPullRequestIncrementalChanges/index.js index c759784034330..1a342b6645cc1 100644 --- a/.github/actions/javascript/getPullRequestIncrementalChanges/index.js +++ b/.github/actions/javascript/getPullRequestIncrementalChanges/index.js @@ -11935,7 +11935,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/isDeployChecklistLocked/index.js b/.github/actions/javascript/isDeployChecklistLocked/index.js index d0c758db3bb02..6a954faf6be8e 100644 --- a/.github/actions/javascript/isDeployChecklistLocked/index.js +++ b/.github/actions/javascript/isDeployChecklistLocked/index.js @@ -11868,7 +11868,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/markPullRequestsAsDeployed/index.js b/.github/actions/javascript/markPullRequestsAsDeployed/index.js index cc846fdfc6442..6d520948141f2 100644 --- a/.github/actions/javascript/markPullRequestsAsDeployed/index.js +++ b/.github/actions/javascript/markPullRequestsAsDeployed/index.js @@ -13137,7 +13137,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/postTestBuildComment/index.js b/.github/actions/javascript/postTestBuildComment/index.js index d5bc4d81cb00e..cacbcdd353d2e 100644 --- a/.github/actions/javascript/postTestBuildComment/index.js +++ b/.github/actions/javascript/postTestBuildComment/index.js @@ -11814,7 +11814,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/proposalPoliceComment/index.js b/.github/actions/javascript/proposalPoliceComment/index.js index 5b039517f4f4e..020a4ca6dab49 100644 --- a/.github/actions/javascript/proposalPoliceComment/index.js +++ b/.github/actions/javascript/proposalPoliceComment/index.js @@ -11988,7 +11988,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(42186)); const utils_1 = __nccwpck_require__(73030); const plugin_paginate_rest_1 = __nccwpck_require__(64193); @@ -12535,7 +12535,6 @@ class OpenAIUtils { model, input, instructions, - // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-deprecated // eslint-disable-next-line @typescript-eslint/naming-convention prompt_cache_key: promptCacheKey, // eslint-disable-next-line @typescript-eslint/naming-convention @@ -12571,7 +12570,7 @@ class OpenAIUtils { let response = ''; let count = 0; while (!response && count < OpenAIUtils.MAX_POLL_COUNT) { - // eslint-disable-next-line @typescript-eslint/naming-convention + // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-deprecated run = await this.client.beta.threads.runs.retrieve(run.id, { thread_id: thread.id }); if (run.status !== OpenAIUtils.OPENAI_RUN_COMPLETED) { count++; diff --git a/.github/actions/javascript/reopenIssueWithComment/index.js b/.github/actions/javascript/reopenIssueWithComment/index.js index 8658cbfe04d93..39520938469d0 100644 --- a/.github/actions/javascript/reopenIssueWithComment/index.js +++ b/.github/actions/javascript/reopenIssueWithComment/index.js @@ -11695,7 +11695,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/reviewerChecklist/index.js b/.github/actions/javascript/reviewerChecklist/index.js index f3c0751522ec2..2dfb1fa8ef0f2 100644 --- a/.github/actions/javascript/reviewerChecklist/index.js +++ b/.github/actions/javascript/reviewerChecklist/index.js @@ -11787,7 +11787,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/verifySignedCommits/index.js b/.github/actions/javascript/verifySignedCommits/index.js index 1eee873f79a44..8dde1a048b1c6 100644 --- a/.github/actions/javascript/verifySignedCommits/index.js +++ b/.github/actions/javascript/verifySignedCommits/index.js @@ -11727,7 +11727,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/actions/javascript/waitForPreviousRuns/index.js b/.github/actions/javascript/waitForPreviousRuns/index.js index 73314abcea779..5b333852e9caf 100644 --- a/.github/actions/javascript/waitForPreviousRuns/index.js +++ b/.github/actions/javascript/waitForPreviousRuns/index.js @@ -11736,7 +11736,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ const core = __importStar(__nccwpck_require__(2186)); const utils_1 = __nccwpck_require__(3030); const plugin_paginate_rest_1 = __nccwpck_require__(4193); diff --git a/.github/libs/DeployChecklistUtils.ts b/.github/libs/DeployChecklistUtils.ts index bde096c2d5272..86c7353e9cea8 100644 --- a/.github/libs/DeployChecklistUtils.ts +++ b/.github/libs/DeployChecklistUtils.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import type {components as OctokitComponents} from '@octokit/openapi-types/types'; import dedent from '@libs/StringUtils/dedent'; import CONST from './CONST'; diff --git a/.github/libs/GithubUtils.ts b/.github/libs/GithubUtils.ts index 5d1e17d9b3924..37a5a6355e7e9 100644 --- a/.github/libs/GithubUtils.ts +++ b/.github/libs/GithubUtils.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ import * as core from '@actions/core'; import {getOctokitOptions, GitHub} from '@actions/github/lib/utils'; import type {Octokit as OctokitCore} from '@octokit/core'; diff --git a/__mocks__/@react-navigation/native/index.ts b/__mocks__/@react-navigation/native/index.ts index ac35335a4623d..b2741a2475b0a 100644 --- a/__mocks__/@react-navigation/native/index.ts +++ b/__mocks__/@react-navigation/native/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/prefer-default-export, import/no-import-module-exports */ import type * as ReactNavigation from '@react-navigation/native'; import createAddListenerMock from '../../../tests/utils/createAddListenerMock'; diff --git a/__mocks__/expo-video.tsx b/__mocks__/expo-video.tsx index 9ba8c9426ad9a..906a364e932dd 100644 --- a/__mocks__/expo-video.tsx +++ b/__mocks__/expo-video.tsx @@ -98,6 +98,7 @@ function useVideoPlayer(..._args: unknown[]): VideoPlayer { type VideoViewProps = ViewProps & {player?: VideoPlayer}; const VideoView = forwardRef((props: VideoViewProps, ref: ForwardedRef) => ( + // eslint-disable-next-line react/jsx-props-no-spreading diff --git a/config/webpack/webpack.common.ts b/config/webpack/webpack.common.ts index 3e8a63ef615c3..c4f9e01944aba 100644 --- a/config/webpack/webpack.common.ts +++ b/config/webpack/webpack.common.ts @@ -209,6 +209,7 @@ const getCommonConfiguration = ({file = '.env', platform = 'web'}: Environment): ...(isDevelopment ? [] : ([ + // eslint-disable-next-line @typescript-eslint/no-unsafe-call sentryWebpackPlugin({ authToken: process.env.SENTRY_AUTH_TOKEN as string | undefined, org: 'expensify', diff --git a/jest/setup.ts b/jest/setup.ts index 19c257614d075..d5726068b0bdf 100644 --- a/jest/setup.ts +++ b/jest/setup.ts @@ -1,3 +1,4 @@ +/* eslint-disable max-classes-per-file */ // Polyfill necessary for Onyx.init in jest/setupAfterEnv.ts import * as core from '@actions/core'; import '@shopify/flash-list/jestSetup'; diff --git a/jest/setupMockImages.ts b/jest/setupMockImages.ts index 3367601060129..a02ef68088f3c 100644 --- a/jest/setupMockImages.ts +++ b/jest/setupMockImages.ts @@ -3,6 +3,7 @@ import path from 'path'; function mockImages(imagePath: string) { const imageFilenames = fs.readdirSync(path.resolve(__dirname, `../assets/${imagePath}/`)); + // eslint-disable-next-line rulesdir/prefer-early-return for (const fileName of imageFilenames) { if (/\.svg/.test(fileName)) { jest.mock(`../assets/${imagePath}/${fileName}`, () => () => ''); diff --git a/modules/ExpensifyNitroUtils/src/specs/ContactsModule.nitro.ts b/modules/ExpensifyNitroUtils/src/specs/ContactsModule.nitro.ts index ea45215606045..0dd71c20b8f67 100644 --- a/modules/ExpensifyNitroUtils/src/specs/ContactsModule.nitro.ts +++ b/modules/ExpensifyNitroUtils/src/specs/ContactsModule.nitro.ts @@ -24,6 +24,7 @@ type Contact = { imageData?: string; }; +// eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface ContactsModule extends HybridObject<{ios: 'swift'; android: 'kotlin'}> { getAll(keys: ContactFields[]): Promise; } diff --git a/package-lock.json b/package-lock.json index 3c22823c4344f..136d4d29aba1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -238,7 +238,7 @@ "dotenv": "^16.0.3", "eslint": "^9.36.0", "eslint-config-airbnb-typescript": "^18.0.0", - "eslint-config-expensify": "2.0.106", + "eslint-config-expensify": "2.0.105", "eslint-config-prettier": "^9.1.0", "eslint-plugin-file-progress": "3.0.1", "eslint-plugin-jest": "^29.0.1", @@ -470,6 +470,27 @@ "node": ">=6.0.0" } }, + "node_modules/@asamuzakjp/css-color": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz", + "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^2.1.3", + "@csstools/css-color-parser": "^3.0.9", + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3", + "lru-cache": "^10.4.3" + } + }, + "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, "node_modules/@aws-crypto/crc32": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", @@ -4762,6 +4783,121 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@csstools/color-helpers": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.1.0.tgz", + "integrity": "sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=18" + } + }, + "node_modules/@csstools/css-calc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz", + "integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.1.0.tgz", + "integrity": "sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^5.1.0", + "@csstools/css-calc": "^2.1.4" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz", + "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz", + "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "dev": true, @@ -20840,6 +20976,20 @@ "dev": true, "license": "MIT" }, + "node_modules/cssstyle": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz", + "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^3.2.0", + "rrweb-cssom": "^0.8.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/csstype": { "version": "3.1.1", "license": "MIT" @@ -21048,6 +21198,47 @@ "dev": true, "license": "BSD-2-Clause" }, + "node_modules/data-urls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/data-urls/node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/data-urls/node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/data-view-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", @@ -22264,9 +22455,9 @@ } }, "node_modules/eslint-config-expensify": { - "version": "2.0.106", - "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.106.tgz", - "integrity": "sha512-BkHszBMfO8j1rZREARKTxgDUuLsh3EFbZ1/3zrYzGs1udeEFmzqYwpCBA+Ey7NDKGAbHBLo0Oke4jgy2ymgi3g==", + "version": "2.0.105", + "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.105.tgz", + "integrity": "sha512-fH8w9XSN53xsTKPt6qxqq+L7B/6Pd6cNyzUL8TexfJRiG9SM9BCAE8Jitlrp/PhDbyfDsZxWPTGbLlbuYLm7Yw==", "dev": true, "license": "ISC", "dependencies": { @@ -26175,6 +26366,30 @@ "node": ">=8.0.0" } }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/http-proxy-middleware": { "version": "2.0.7", "dev": true, @@ -28005,21 +28220,6 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/jest-environment-jsdom/node_modules/http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/jest-environment-jsdom/node_modules/jsdom": { "version": "20.0.3", "dev": true, @@ -28075,32 +28275,6 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/jest-environment-jsdom/node_modules/tough-cookie": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", - "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.2.0", - "url-parse": "^1.5.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-environment-jsdom/node_modules/tough-cookie/node_modules/universalify": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", - "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/jest-environment-jsdom/node_modules/tr46": { "version": "3.0.0", "dev": true, @@ -28151,6 +28325,47 @@ "node": ">=12" } }, + "node_modules/jest-environment-jsdom/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-environment-jsdom/node_modules/tough-cookie": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", + "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jest-environment-jsdom/node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/jest-environment-node": { "version": "29.7.0", "license": "MIT", @@ -35493,6 +35708,13 @@ "rock": "dist/src/bin.js" } }, + "node_modules/rrweb-cssom": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz", + "integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==", + "dev": true, + "license": "MIT" + }, "node_modules/run-applescript": { "version": "7.0.0", "dev": true, @@ -37627,6 +37849,26 @@ "node": ">=14.0.0" } }, + "node_modules/tldts": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz", + "integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^6.1.86" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz", + "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==", + "dev": true, + "license": "MIT" + }, "node_modules/tmpl": { "version": "1.0.5", "license": "BSD-3-Clause" @@ -37656,6 +37898,19 @@ "node": ">=6" } }, + "node_modules/tough-cookie": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz", + "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^6.1.32" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/tr46": { "version": "0.0.3", "license": "MIT" @@ -38445,6 +38700,19 @@ "pbf": "^3.2.1" } }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/wait-port": { "version": "0.2.14", "dev": true, @@ -39002,6 +39270,16 @@ "version": "3.6.2", "license": "MIT" }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/whatwg-url": { "version": "5.0.0", "license": "MIT", @@ -39383,6 +39661,16 @@ "node": ">=0.8" } }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, "node_modules/xml2js": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.0.tgz", diff --git a/package.json b/package.json index 713ae68b205c4..9782e590a1aa9 100644 --- a/package.json +++ b/package.json @@ -302,7 +302,7 @@ "dotenv": "^16.0.3", "eslint": "^9.36.0", "eslint-config-airbnb-typescript": "^18.0.0", - "eslint-config-expensify": "2.0.106", + "eslint-config-expensify": "2.0.105", "eslint-config-prettier": "^9.1.0", "eslint-plugin-file-progress": "3.0.1", "eslint-plugin-jest": "^29.0.1", diff --git a/scripts/bumpVersion.ts b/scripts/bumpVersion.ts index 369776a3b7843..b502397642b11 100755 --- a/scripts/bumpVersion.ts +++ b/scripts/bumpVersion.ts @@ -10,7 +10,9 @@ import getBuildVersion from 'semver/functions/prerelease'; import type {PackageJson} from 'type-fest'; import {promisify} from 'util'; // Disabling lint on the next two imports due to a bug in @dword-design/import-alias/prefer-alias +// eslint-disable-next-line import * as versionUpdater from '@github/libs/versionUpdater'; +// eslint-disable-next-line import type {SemverLevel} from '@github/libs/versionUpdater'; const exec = promisify(originalExec); diff --git a/scripts/utils/OpenAIUtils.ts b/scripts/utils/OpenAIUtils.ts index 3567e9e38fa16..4f2803a5000e0 100644 --- a/scripts/utils/OpenAIUtils.ts +++ b/scripts/utils/OpenAIUtils.ts @@ -75,7 +75,6 @@ class OpenAIUtils { model, input, instructions, - // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-deprecated // eslint-disable-next-line @typescript-eslint/naming-convention prompt_cache_key: promptCacheKey, // eslint-disable-next-line @typescript-eslint/naming-convention @@ -123,7 +122,7 @@ class OpenAIUtils { let response = ''; let count = 0; while (!response && count < OpenAIUtils.MAX_POLL_COUNT) { - // eslint-disable-next-line @typescript-eslint/naming-convention + // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-deprecated run = await this.client.beta.threads.runs.retrieve(run.id, {thread_id: thread.id}); if (run.status !== OpenAIUtils.OPENAI_RUN_COMPLETED) { count++; diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 9baeee7f738f7..bd6f2550775df 100644 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -4091,9 +4091,11 @@ const CONST = { DOMAIN_BASE: '^(?:https?:\\/\\/)?(?:www\\.)?([^\\/]+)', ALPHANUMERIC_WITH_SPACE_AND_HYPHEN: /^[A-Za-z0-9 -]+$/, - // eslint-disable-next-line no-misleading-character-class + // eslint-disable-next-line max-len, no-misleading-character-class EMOJI: /[\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu, + // eslint-disable-next-line max-len, no-misleading-character-class, no-empty-character-class EMOJIS: /[\p{Extended_Pictographic}\uE000-\uF8FF\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}](\u200D[\p{Extended_Pictographic}\uE000-\uF8FF\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}]|[\u{1F3FB}-\u{1F3FF}]|[\u{E0020}-\u{E007F}]|\uFE0F|\u20E3)*|[\u{1F1E6}-\u{1F1FF}]{2}|[#*0-9]\uFE0F?\u20E3/du, + // eslint-disable-next-line max-len, no-misleading-character-class EMOJI_SKIN_TONES: /[\u{1f3fb}-\u{1f3ff}]/gu, PRIVATE_USER_AREA: /[\uE000-\uF8FF\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}]/u, diff --git a/src/ROUTES.ts b/src/ROUTES.ts index beb5f1901ddf5..1927333078e2d 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -531,6 +531,7 @@ const ROUTES = { // eslint-disable-next-line no-restricted-syntax -- Legacy route generation `${getUrlWithBackToParam(`settings/profile/address/state${state ? `?state=${encodeURIComponent(state)}` : ''}`, backTo)}${ // the label param can be an empty string so we cannot use a nullish ?? operator + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing label ? `${backTo || state ? '&' : '?'}label=${encodeURIComponent(label)}` : '' }` as const, }, @@ -1424,6 +1425,7 @@ const ROUTES = { // eslint-disable-next-line no-restricted-syntax -- Legacy route generation `${getUrlWithBackToParam(`submit/state${state ? `?state=${encodeURIComponent(state)}` : ''}`, backTo)}${ // the label param can be an empty string so we cannot use a nullish ?? operator + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing label ? `${backTo || state ? '&' : '?'}label=${encodeURIComponent(label)}` : '' }` as const, }, diff --git a/src/components/ActionSheetAwareScrollView/useActionSheetKeyboardSpacing.ts b/src/components/ActionSheetAwareScrollView/useActionSheetKeyboardSpacing.ts index 6463863770d7f..6f917d7cd886a 100644 --- a/src/components/ActionSheetAwareScrollView/useActionSheetKeyboardSpacing.ts +++ b/src/components/ActionSheetAwareScrollView/useActionSheetKeyboardSpacing.ts @@ -75,6 +75,7 @@ function useActionSheetKeyboardSpacing(scrollViewAnimatedRef: AnimatedRef { return () => resetStateMachine(); }, [resetStateMachine]); diff --git a/src/components/AddPlaidBankAccount.tsx b/src/components/AddPlaidBankAccount.tsx index c86837bf1cd1f..dd9634274207e 100644 --- a/src/components/AddPlaidBankAccount.tsx +++ b/src/components/AddPlaidBankAccount.tsx @@ -217,6 +217,7 @@ function AddPlaidBankAccount({ } }} // User prematurely exited the Plaid flow + // eslint-disable-next-line react/jsx-props-no-multi-spaces onExit={onExitPlaid} receivedRedirectURI={receivedRedirectURI} /> diff --git a/src/components/AddressSearch/index.tsx b/src/components/AddressSearch/index.tsx index 965aec7176347..ff8bf9746bfe1 100644 --- a/src/components/AddressSearch/index.tsx +++ b/src/components/AddressSearch/index.tsx @@ -89,6 +89,7 @@ function AddressSearch({ const [displayListViewBorder, setDisplayListViewBorder] = useState(false); const [isTyping, setIsTyping] = useState(false); const [isFocused, setIsFocused] = useState(false); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const [searchValue, setSearchValue] = useState(''); const [locationErrorCode, setLocationErrorCode] = useState(null); const [isFetchingCurrentLocation, setIsFetchingCurrentLocation] = useState(false); @@ -307,6 +308,7 @@ function AddressSearch({ ); + // eslint-disable-next-line arrow-body-style useEffect(() => { return () => { // If the component unmounts we don't want any of the callback for geolocation to run. diff --git a/src/components/AutoCompleteSuggestions/AutoCompleteSuggestionsPortal/index.native.tsx b/src/components/AutoCompleteSuggestions/AutoCompleteSuggestionsPortal/index.native.tsx index 7fa3643506395..0a51c6b92bbc6 100644 --- a/src/components/AutoCompleteSuggestions/AutoCompleteSuggestionsPortal/index.native.tsx +++ b/src/components/AutoCompleteSuggestions/AutoCompleteSuggestionsPortal/index.native.tsx @@ -20,7 +20,7 @@ function AutoCompleteSuggestionsPortal({left = 0, width = 0, bottom - {} + {/* eslint-disable-next-line react/jsx-props-no-spreading */} width={width} // eslint-disable-next-line react/jsx-props-no-spreading diff --git a/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.tsx b/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.tsx index 111e7e9526841..0cd97ef55eb66 100644 --- a/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.tsx +++ b/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.tsx @@ -84,8 +84,9 @@ function BaseAutoCompleteSuggestions({ // When using cursor control (moving the cursor with the space bar on the keyboard) on Android, moving the cursor too fast may cause an error. try { scrollRef.current.scrollToIndex({index: highlightedSuggestionIndex, animated: true}); - // eslint-disable-next-line no-empty - } catch (e) {} + } catch (e) { + // eslint-disable-next-line no-console + } }, [highlightedSuggestionIndex]); return ( diff --git a/src/components/BlockingViews/FullPageErrorView.tsx b/src/components/BlockingViews/FullPageErrorView.tsx index 9789b82fd0fd5..a40e510c57cc0 100644 --- a/src/components/BlockingViews/FullPageErrorView.tsx +++ b/src/components/BlockingViews/FullPageErrorView.tsx @@ -32,6 +32,7 @@ type FullPageErrorViewProps = { containerStyle?: StyleProp; }; +// eslint-disable-next-line rulesdir/no-negated-variables function FullPageErrorView({testID, children = null, shouldShow = false, title = '', subtitle = '', shouldForceFullScreen = false, subtitleStyle, containerStyle}: FullPageErrorViewProps) { const styles = useThemeStyles(); const illustrations = useMemoizedLazyIllustrations(['BrokenMagnifyingGlass']); diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index 2334c953e73a4..89fa7f739f189 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -354,6 +354,7 @@ function Button({ const defaultFill = success || danger ? theme.textLight : theme.icon; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (icon || shouldShowRightIcon) { return ( diff --git a/src/components/Composer/types.ts b/src/components/Composer/types.ts index 763eb7163d3f3..3824aac67445b 100644 --- a/src/components/Composer/types.ts +++ b/src/components/Composer/types.ts @@ -42,6 +42,7 @@ type ComposerProps = Omit & onPasteFile?: (files: FileObject | FileObject[]) => void; /** General styles to apply to the text input */ + // eslint-disable-next-line react/forbid-prop-types style?: StyleProp; /** Whether or not this TextInput is disabled. */ diff --git a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.android.ts b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.android.ts index 2036cbff2db0b..c25f45bfb050c 100644 --- a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.android.ts +++ b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.android.ts @@ -1,6 +1,7 @@ import StatusBar from '@libs/StatusBar'; import type UpdateStatusBarAppearanceProps from './types'; +// eslint-disable-next-line @typescript-eslint/naming-convention export default function updateStatusBarAppearance({statusBarStyle}: UpdateStatusBarAppearanceProps) { StatusBar.setBackgroundColor('transparent'); StatusBar.setTranslucent(true); diff --git a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ios.ts b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ios.ts index 4504bc8624b40..e887b5f0a98b1 100644 --- a/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ios.ts +++ b/src/components/CustomStatusBarAndBackground/updateStatusBarAppearance/index.ios.ts @@ -1,6 +1,7 @@ import StatusBar from '@libs/StatusBar'; import type UpdateStatusBarAppearanceProps from './types'; +// eslint-disable-next-line @typescript-eslint/naming-convention export default function updateStatusBarAppearance({statusBarStyle}: UpdateStatusBarAppearanceProps) { if (!statusBarStyle) { return; diff --git a/src/components/DotIndicatorMessage.tsx b/src/components/DotIndicatorMessage.tsx index 3694bd9f290ce..98877386d74ed 100644 --- a/src/components/DotIndicatorMessage.tsx +++ b/src/components/DotIndicatorMessage.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react/no-array-index-key */ import {Str} from 'expensify-common'; import type {ReactElement} from 'react'; import React from 'react'; @@ -99,6 +100,7 @@ function DotIndicatorMessage({messages = {}, style, type, textStyles, dismissErr return ( ({ renderItem, keyExtractor, onDragEnd: onDragEndCallback, + // eslint-disable-next-line @typescript-eslint/naming-convention ListFooterComponent, disableScroll, ref, diff --git a/src/components/EmojiPicker/EmojiPickerButtonDropdown.tsx b/src/components/EmojiPicker/EmojiPickerButtonDropdown.tsx index 52cc88fb663f7..71233e7cd28ff 100644 --- a/src/components/EmojiPicker/EmojiPickerButtonDropdown.tsx +++ b/src/components/EmojiPicker/EmojiPickerButtonDropdown.tsx @@ -34,6 +34,7 @@ type EmojiPickerButtonDropdownProps = { function EmojiPickerButtonDropdown( // eslint-disable-next-line @typescript-eslint/no-unused-vars {isDisabled = false, withoutOverlay = false, onModalHide, onInputChange, value, disabled, style, ref, ...otherProps}: EmojiPickerButtonDropdownProps, + // eslint-disable-next-line @typescript-eslint/no-unused-vars ) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); diff --git a/src/components/EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.ts b/src/components/EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.ts index b5c11800ae509..62947fb642741 100644 --- a/src/components/EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.ts +++ b/src/components/EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.ts @@ -14,6 +14,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; const useEmojiPickerMenu = () => { const emojiListRef = useRef>(null); const [frequentlyUsedEmojis] = useOnyx(ONYXKEYS.FREQUENTLY_USED_EMOJIS); + // eslint-disable-next-line react-hooks/exhaustive-deps const allEmojis = useMemo(() => mergeEmojisWithFrequentlyUsedEmojis(emojis, processFrequentlyUsedEmojis(frequentlyUsedEmojis)), [frequentlyUsedEmojis]); const headerEmojis = useMemo(() => getHeaderEmojis(allEmojis), [allEmojis]); const headerRowIndices = useMemo(() => headerEmojis.map((headerEmoji) => headerEmoji.index), [headerEmojis]); diff --git a/src/components/FlatList/FlatList/index.android.tsx b/src/components/FlatList/FlatList/index.android.tsx index fdf595742bcfe..9ac8f70b2d532 100644 --- a/src/components/FlatList/FlatList/index.android.tsx +++ b/src/components/FlatList/FlatList/index.android.tsx @@ -24,6 +24,7 @@ function CustomFlatList({ref, enableAnimatedKeyboardDismissal = false, onMome } }, [ref]); + // eslint-disable-next-line react-hooks/exhaustive-deps const handleScrollEnd = useCallback( (event: NativeSyntheticEvent) => { onMomentumScrollEnd?.(event); diff --git a/src/components/FlatList/FlatList/index.tsx b/src/components/FlatList/FlatList/index.tsx index f7423a3ae555f..022bc2047acc5 100644 --- a/src/components/FlatList/FlatList/index.tsx +++ b/src/components/FlatList/FlatList/index.tsx @@ -1,3 +1,4 @@ +/* eslint-disable es/no-optional-chaining, es/no-nullish-coalescing-operators, react/prop-types */ import type {ForwardedRef, RefObject} from 'react'; import React, {useCallback, useEffect, useMemo, useRef} from 'react'; import type {NativeScrollEvent, NativeSyntheticEvent} from 'react-native'; @@ -24,6 +25,7 @@ function mergeRefs(...args: Array | ForwardedRef | continue; } if (typeof ref === 'object') { + // eslint-disable-next-line no-param-reassign ref.current = node; continue; } diff --git a/src/components/GPSTripStateChecker/useUpdateGpsTripOnReconnect.ts b/src/components/GPSTripStateChecker/useUpdateGpsTripOnReconnect.ts index 203295e1922f9..e5a9578ca97f6 100644 --- a/src/components/GPSTripStateChecker/useUpdateGpsTripOnReconnect.ts +++ b/src/components/GPSTripStateChecker/useUpdateGpsTripOnReconnect.ts @@ -37,6 +37,7 @@ function useUpdateGpsTripOnReconnect() { }; // This is intentional to use async/await pattern for better readability + // eslint-disable-next-line @typescript-eslint/no-misused-promises useNetwork({onReconnect: updateAddressesToHumanReadable}); } diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx index 7604fa2520de1..9e3f00124f84c 100755 --- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx +++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx @@ -231,6 +231,7 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim recognizeSelfClosing: true, }} domVisitors={{ + // eslint-disable-next-line no-param-reassign onText: (text) => { // Avoid injecting LTR controls into whitespace-only nodes. // Doing so turns otherwise ignorable whitespace into visible content in some renderers (Android), diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.tsx index b45f64d0f2591..85b24c17d73c8 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.tsx @@ -130,6 +130,7 @@ function AnchorRenderer({tnode, style, key}: AnchorRendererProps) { // a new window. On Desktop this means that we will // skip the default Save As... download prompt // and defer to whatever browser the user has. + // eslint-disable-next-line react/jsx-props-no-multi-spaces target={htmlAttribs.target || '_blank'} rel={htmlAttribs.rel || 'noopener noreferrer'} style={[ diff --git a/src/components/Hoverable/index.tsx b/src/components/Hoverable/index.tsx index cb6420ca7ef46..14e73343a77e7 100644 --- a/src/components/Hoverable/index.tsx +++ b/src/components/Hoverable/index.tsx @@ -12,6 +12,7 @@ import type HoverableProps from './types'; */ function Hoverable({isDisabled, ref, ...props}: HoverableProps) { // If Hoverable is disabled, just render the child without additional logic or event listeners. + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (isDisabled || !hasHoverSupport()) { const child = getReturnValue(props.children, false); return cloneElement(child, {ref: mergeRefs(ref, child.props.ref)} as React.HTMLAttributes); diff --git a/src/components/Icon/ExpensifyIconLoader.ts b/src/components/Icon/ExpensifyIconLoader.ts index bc85df95cf1a0..df4393bf7f15f 100644 --- a/src/components/Icon/ExpensifyIconLoader.ts +++ b/src/components/Icon/ExpensifyIconLoader.ts @@ -65,6 +65,7 @@ function loadExpensifyIcon(iconName: ExpensifyIconName): {default: IconAsset} | return {default: icon}; }) .catch((error) => { + // eslint-disable-next-line no-console console.error(`Failed to load ExpensifyIcon: ${iconName}`, error); throw error; }); diff --git a/src/components/Icon/IllustrationLoader.ts b/src/components/Icon/IllustrationLoader.ts index 71adbdbc1a596..ef80d6bef5948 100644 --- a/src/components/Icon/IllustrationLoader.ts +++ b/src/components/Icon/IllustrationLoader.ts @@ -63,6 +63,7 @@ function loadIllustration(illustrationName: IllustrationName): {default: IconAss return {default: illustration}; // Changed to return {default: illustration} }) .catch((error) => { + // eslint-disable-next-line no-console console.error(`Failed to load Illustration: ${illustrationName}`, error); throw error; }); diff --git a/src/components/Image/index.tsx b/src/components/Image/index.tsx index 05d6a9eb52b8b..5f7bb1ad07085 100644 --- a/src/components/Image/index.tsx +++ b/src/components/Image/index.tsx @@ -79,6 +79,7 @@ function Image({ * trying to figure out if the current session is expired or fresh from a necessary reauthentication */ const previousSessionAge = useRef(undefined); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const validSessionAge: number | undefined = useMemo(() => { // Authentication is required only for certain types of images (attachments and receipts), // so we only calculate the session age for those diff --git a/src/components/KYCWall/BaseKYCWall.tsx b/src/components/KYCWall/BaseKYCWall.tsx index 9267593bf349f..379024027f38f 100644 --- a/src/components/KYCWall/BaseKYCWall.tsx +++ b/src/components/KYCWall/BaseKYCWall.tsx @@ -255,6 +255,7 @@ function KYCWall({ return; } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (paymentMethod || policy) { setShouldShowAddPaymentMenu(false); selectPaymentMethod(paymentMethod, policy); @@ -290,6 +291,7 @@ function KYCWall({ return; } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (policy || (paymentMethod && (!hasActivatedWallet || paymentMethod !== CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT))) { setShouldShowAddPaymentMenu(false); selectPaymentMethod(paymentMethod, policy); diff --git a/src/components/KeyboardDismissibleFlatList/types.ts b/src/components/KeyboardDismissibleFlatList/types.ts index c42c1cd8c7704..e914727325e38 100644 --- a/src/components/KeyboardDismissibleFlatList/types.ts +++ b/src/components/KeyboardDismissibleFlatList/types.ts @@ -19,4 +19,5 @@ type KeyboardDismissibleFlatListActionsContextValue = { type KeyboardDismissibleFlatListContextValue = KeyboardDismissibleFlatListStateContextValue & KeyboardDismissibleFlatListActionsContextValue; +// eslint-disable-next-line import/prefer-default-export export type {KeyboardDismissibleFlatListContextValue, KeyboardDismissibleFlatListStateContextValue, KeyboardDismissibleFlatListActionsContextValue, ListBehavior}; diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index c074280d8437c..0e794a1187eca 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import {useIsFocused, useRoute} from '@react-navigation/native'; import type {FlashListProps, FlashListRef} from '@shopify/flash-list'; import {FlashList} from '@shopify/flash-list'; diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index 8c6973fdd8efe..10667000b6c07 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -100,7 +100,11 @@ function OptionRowLHN({ [optionItem?.alternateText], ); - const delegateAccountID = useMemo(() => getDelegateAccountIDFromReportAction(optionItem?.parentReportAction), [optionItem?.parentReportAction]); + const delegateAccountID = useMemo( + () => getDelegateAccountIDFromReportAction(optionItem?.parentReportAction), + // eslint-disable-next-line react-hooks/exhaustive-deps -- getDelegateAccountIDFromReportAction is a stable import; only parentReportAction determines the result + [optionItem?.parentReportAction], + ); // Match the header's delegate avatar logic: when a delegate exists on the // parent report action, the header (useReportActionAvatars) shows the @@ -234,6 +238,7 @@ function OptionRowLHN({ needsOffscreenAlphaCompositing > Number(icon.id) === reportPreviewSenderID); return {...optionItem, icons: [senderIcon ?? optionItem.icons.at(0)].filter((icon): icon is Icon => !!icon)}; }, [optionItem, isIOUReport, reportPreviewSenderID]); diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index 5cbc7ac81440d..ae9ac11f917e7 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -802,6 +802,7 @@ function MenuItem({ {!!label && isLabelHoverable && ( + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing {label} @@ -810,7 +811,7 @@ function MenuItem({ )} {!!leftComponent && {leftComponent}} - {} + {/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */} {isIDPassed && ( { if (isVisible && !isContainerOpen && !isTransitioning) { + // eslint-disable-next-line @typescript-eslint/no-deprecated handleRef.current = InteractionManager.createInteractionHandle(); onModalWillShow(); setIsVisibleState(true); setIsTransitioning(true); } else if (!isVisible && isContainerOpen && !isTransitioning) { + // eslint-disable-next-line @typescript-eslint/no-deprecated handleRef.current = InteractionManager.createInteractionHandle(); onModalWillHide(); @@ -135,6 +138,7 @@ function ReanimatedModal({ setIsTransitioning(false); setIsContainerOpen(true); if (handleRef.current) { + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.clearInteractionHandle(handleRef.current); } onModalShow(); @@ -144,6 +148,7 @@ function ReanimatedModal({ setIsTransitioning(false); setIsContainerOpen(false); if (handleRef.current) { + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.clearInteractionHandle(handleRef.current); } @@ -209,6 +214,7 @@ function ReanimatedModal({ { Navigation.goBack(backToRoute); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { deleteAppReport(moneyRequestReport, selfDMReport, email ?? '', accountID, reportTransactions, allTransactionViolations, bankAccountList, currentSearchHash); }); diff --git a/src/components/MoneyRequestConfirmationListFooter.tsx b/src/components/MoneyRequestConfirmationListFooter.tsx index 732b9bb3f4bb3..f74d6111cccc3 100644 --- a/src/components/MoneyRequestConfirmationListFooter.tsx +++ b/src/components/MoneyRequestConfirmationListFooter.tsx @@ -1111,6 +1111,7 @@ function MoneyRequestConfirmationListFooter({ style={styles.h100} > ({ return () => icon(size); } + // eslint-disable-next-line react/display-name return () => ( {children}; } + // eslint-disable-next-line react/jsx-no-useless-fragment return {children}; }; @@ -385,10 +386,12 @@ function BasePopoverMenu({ const icon = typeof item.icon === 'string' ? expensifyIcons[item.icon as keyof typeof expensifyIcons] : item.icon; return ( ))} diff --git a/src/components/QRShare/QRShareWithDownload/index.tsx b/src/components/QRShare/QRShareWithDownload/index.tsx index f6dffa5573ddf..eeebbad413b04 100644 --- a/src/components/QRShare/QRShareWithDownload/index.tsx +++ b/src/components/QRShare/QRShareWithDownload/index.tsx @@ -17,6 +17,7 @@ function QRShareWithDownload({ref, ...props}: QRShareWithDownloadProps) { () => ({ download: () => new Promise((resolve, reject) => { + // eslint-disable-next-line es/no-optional-chaining const svg = qrShareRef.current?.getSvg(); if (!svg) { reject(); diff --git a/src/components/ReportActionAvatars/useReportActionAvatars.ts b/src/components/ReportActionAvatars/useReportActionAvatars.ts index ebc258b29f539..3c80c1033dc20 100644 --- a/src/components/ReportActionAvatars/useReportActionAvatars.ts +++ b/src/components/ReportActionAvatars/useReportActionAvatars.ts @@ -108,6 +108,7 @@ function useReportActionAvatars({ const {chatReportIDAdmins, chatReportIDAnnounce, workspaceAccountID} = policy ?? {}; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const [policyChatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${Number(chatReportIDAnnounce) ? chatReportIDAnnounce : chatReportIDAdmins}`); const delegateAccountID = getDelegateAccountIDFromReportAction(action); @@ -150,6 +151,7 @@ function useReportActionAvatars({ ...(personalDetails?.[workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID] ?? {}), shouldDisplayAllActors: false, isWorkspaceActor: false, + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing actorHint: String(policyID).replaceAll(CONST.REGEX.MERGED_ACCOUNT_PREFIX, ''), accountID: workspaceAccountID, delegateAccountID: undefined, @@ -187,6 +189,7 @@ function useReportActionAvatars({ !shouldShowConvertedSubscriptAvatar) || shouldUseCardFeed; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const shouldUseMultipleAvatars = shouldUseAccountIDs || shouldShowAllActors || shouldShowConvertedSubscriptAvatar; let avatarType: ValueOf = CONST.REPORT_ACTION_AVATARS.TYPE.SINGLE; @@ -288,6 +291,7 @@ function useReportActionAvatars({ const iouReportIcons = getIconsWithDefaults(iouReport); secondaryAvatar = iouReportIcons.at(iouReportIcons.at(1)?.id === primaryAvatar.id ? 0 : 1); } else if (!isWorkspaceActor) { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing secondaryAvatar = reportIcons.at(chatReport?.isOwnPolicyExpenseChat || isAWorkspaceChat ? 0 : 1); } else if (isAInvoiceReport) { secondaryAvatar = reportIcons.at(1); @@ -307,6 +311,7 @@ function useReportActionAvatars({ avatarType === CONST.REPORT_ACTION_AVATARS.TYPE.SUBSCRIPT && avatars.at(0)?.type === CONST.ICON_TYPE_AVATAR && avatars.at(1)?.type === CONST.ICON_TYPE_WORKSPACE; const isWorkspaceWithUserAvatar = avatars.at(0)?.type === CONST.ICON_TYPE_WORKSPACE && avatars.at(1)?.type === CONST.ICON_TYPE_AVATAR && avatarType === CONST.REPORT_ACTION_AVATARS.TYPE.MULTIPLE; + // eslint-disable-next-line rulesdir/no-negated-variables const wasReportPreviewMovedToDifferentPolicy = shouldUseChangedPolicyID && isAReportPreviewAction; if (shouldUseInvoiceExpenseIcons) { diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 814c68b5ddc1c..3bea4232d9d3c 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -890,7 +890,6 @@ function MoneyRequestReportPreviewContent({ > {/* This will be fixed as follow up https://github.com/Expensify/App/pull/75357 */} {/* eslint-disable-next-line @typescript-eslint/no-deprecated */} - {} {getReportName({report: iouReport, reportAttributes}) || action.childReportName} diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx index 552b51350e095..09f1961779d18 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx @@ -97,6 +97,7 @@ function MoneyRequestReportPreview({ return false; } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing return transactions.some((transaction) => (Number(transaction?.modifiedAmount) || transaction?.amount) < 0); }, [transactions, action.childType, iouReport]); diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index bad57ae54e5bb..2a41e3f3af599 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -382,6 +382,7 @@ function MoneyRequestView({ // Flags for showing categories and tags // transactionCategory can be an empty string + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const shouldShowCategory = (isPolicyExpenseChat && (categoryForDisplay || hasEnabledOptions(policyCategories ?? {}))) || (isExpenseUnreported && (!policyForMovingExpenses || hasEnabledOptions(policyCategories ?? {}))); @@ -773,6 +774,7 @@ function MoneyRequestView({ ); }); + // eslint-disable-next-line @typescript-eslint/no-deprecated const reportNameToDisplay = isFromMergeTransaction ? (updatedTransaction?.reportName ?? translate('common.none')) : getReportName(parentReport, reportAttributes) || parentReport?.reportName; diff --git a/src/components/ReportActionItem/ReportActionItemImage.tsx b/src/components/ReportActionItem/ReportActionItemImage.tsx index ec06332d2a2ea..3b756aa774edf 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.tsx +++ b/src/components/ReportActionItem/ReportActionItemImage.tsx @@ -149,6 +149,7 @@ function ReportActionItemImage({ // PDF won't have originalImage that we can use. Use thumbnail instead // We explicitly want to use || instead of nullish-coalescing because shouldUseThumbnailImage can be false. + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing source: shouldUseThumbnailImage || isPDF ? thumbnailSource : originalImageSource, fallbackIcon: icons.Receipt, fallbackIconSize: isSingleImage ? variables.iconSizeSuperLarge : variables.iconSizeExtraLarge, diff --git a/src/components/ReportActionItem/ReportActionItemImages.tsx b/src/components/ReportActionItem/ReportActionItemImages.tsx index 5eeb3ff85acb1..4d1609fbe89e7 100644 --- a/src/components/ReportActionItem/ReportActionItemImages.tsx +++ b/src/components/ReportActionItem/ReportActionItemImages.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react/no-array-index-key */ import {useMappingHelper} from '@shopify/flash-list'; import {Str} from 'expensify-common'; import React from 'react'; diff --git a/src/components/ReportActionItem/TransactionPreview/index.tsx b/src/components/ReportActionItem/TransactionPreview/index.tsx index 084958e298882..2df580588dbf5 100644 --- a/src/components/ReportActionItem/TransactionPreview/index.tsx +++ b/src/components/ReportActionItem/TransactionPreview/index.tsx @@ -96,6 +96,7 @@ function TransactionPreview(props: TransactionPreviewProps) { const iouAction = action; // See description of `transactionRawAmount` prop for more context + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const transactionRawAmount = (Number(transaction?.modifiedAmount) || transaction?.amount) ?? 0; const shouldDisableOnPress = isBillSplit && isEmptyObject(transaction); diff --git a/src/components/ScreenWrapper/ScreenWrapperContainer.tsx b/src/components/ScreenWrapper/ScreenWrapperContainer.tsx index af56b15c00836..9e1e450f54589 100644 --- a/src/components/ScreenWrapper/ScreenWrapperContainer.tsx +++ b/src/components/ScreenWrapper/ScreenWrapperContainer.tsx @@ -214,6 +214,7 @@ function ScreenWrapperContainer({ fsClass={forwardedFSClass} > 0) { return; } diff --git a/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx b/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx index e1f9c769077bd..3f378d0b7205c 100644 --- a/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx +++ b/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx @@ -148,6 +148,7 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo return; } setShowPopupButton(true); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [searchRouterListVisible]); const onFocus = useCallback(() => { diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 9d4a16a0a71a3..15316f776217a 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -708,6 +708,7 @@ function Search({ transactionItem.report, transactionItem.policy, ), + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing isSelected: areAllMatchingItemsSelected || selectedTransactions[transactionItem.transactionID]?.isSelected || isExpenseReportType, canReject: canRejectRequest, reportID: transactionItem.reportID, @@ -763,6 +764,7 @@ function Search({ transactionItem.report, transactionItem.policy, ), + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing isSelected: areAllMatchingItemsSelected || selectedTransactions[transactionItem.transactionID].isSelected, canReject: canRejectRequest, reportID: transactionItem.reportID, @@ -1160,6 +1162,7 @@ function Search({ }, [hasErrors, queryJSON, searchResults, shouldResetSearchQuery, setShouldResetSearchQuery]); const fetchMoreResults = useCallback(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (!isFocused || !searchResults?.search?.hasMoreResults || shouldShowLoadingState || shouldShowLoadingMoreItems || offset > allDataLength - CONST.SEARCH.RESULTS_PAGE_SIZE) { return; } @@ -1241,6 +1244,7 @@ function Search({ } cancelSpan(CONST.TELEMETRY.SPAN_NAVIGATE_AFTER_EXPENSE_CREATE); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const cancelNavigationSpans = useCallback(() => { diff --git a/src/components/SectionList/index.android.tsx b/src/components/SectionList/index.android.tsx index 4940023f862f3..12da86407a0c3 100644 --- a/src/components/SectionList/index.android.tsx +++ b/src/components/SectionList/index.android.tsx @@ -10,6 +10,7 @@ function SectionListWithRef({ref, ...props}: SectionListProps ); diff --git a/src/components/SelectionList/ListItem/ListItemRenderer.tsx b/src/components/SelectionList/ListItem/ListItemRenderer.tsx index 810fdf3cbba94..7d4d38e0243ac 100644 --- a/src/components/SelectionList/ListItem/ListItemRenderer.tsx +++ b/src/components/SelectionList/ListItem/ListItemRenderer.tsx @@ -86,6 +86,7 @@ function ListItemRenderer({ isAlternateTextMultilineSupported={isAlternateTextMultilineSupported} alternateTextNumberOfLines={alternateTextNumberOfLines} onFocus={(event: NativeSyntheticEvent) => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (shouldIgnoreFocus || isDisabled) { return; } diff --git a/src/components/SelectionList/ListItem/UserListItem.tsx b/src/components/SelectionList/ListItem/UserListItem.tsx index 9ca2578b1c781..c83b28706baa4 100644 --- a/src/components/SelectionList/ListItem/UserListItem.tsx +++ b/src/components/SelectionList/ListItem/UserListItem.tsx @@ -59,6 +59,7 @@ function UserListItem({ } }, [item, onCheckboxPress, onSelectRow]); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const [isReportInOnyx] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${item.reportID}`, { selector: reportExistsSelector, }); @@ -133,6 +134,7 @@ function UserListItem({ isHovered && !isFocused ? StyleUtils.getBackgroundAndBorderStyle(hoveredBackgroundColor) : undefined, ]} reportID={reportExists ? item.reportID : undefined} + /* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */ accountIDs={!reportExists && !!itemAccountID ? [itemAccountID] : []} policyID={!reportExists && !!policyID ? policyID : undefined} singleAvatarContainerStyle={[styles.actionAvatar, styles.mr3]} diff --git a/src/components/SelectionListWithModal/index.tsx b/src/components/SelectionListWithModal/index.tsx index 7f35c01bfb562..27170e170a784 100644 --- a/src/components/SelectionListWithModal/index.tsx +++ b/src/components/SelectionListWithModal/index.tsx @@ -87,6 +87,7 @@ function SelectionListWithModal({ }; const handleLongPressRow = (item: TItem) => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (!turnOnSelectionModeOnLongPress || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) { return; } diff --git a/src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx b/src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx index 2c633c60e0de8..d1d12a84852a1 100644 --- a/src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx +++ b/src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx @@ -95,6 +95,7 @@ function BaseSelectionListItemRenderer({ isAlternateTextMultilineSupported={isAlternateTextMultilineSupported} alternateTextNumberOfLines={alternateTextNumberOfLines} onFocus={(event: NativeSyntheticEvent) => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (shouldIgnoreFocus || isDisabled) { return; } diff --git a/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx b/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx index c04b5fbee8b18..57b3d60dd181c 100644 --- a/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx +++ b/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx @@ -247,6 +247,7 @@ function BaseSelectionListWithSections({ // If disabled, add to the disabled indexes array const isItemDisabled = !!section.isDisabled || (item.isDisabled && !isItemSelected(item)); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (isItemDisabled || item.isDisabledCheckbox) { disabledOptionsIndexes.push(disabledIndex); if (isItemDisabled) { diff --git a/src/components/SelectionListWithSections/Search/ActionCell/PayActionCell.tsx b/src/components/SelectionListWithSections/Search/ActionCell/PayActionCell.tsx index 2b0969afa33d8..ceada0b39d6c5 100644 --- a/src/components/SelectionListWithSections/Search/ActionCell/PayActionCell.tsx +++ b/src/components/SelectionListWithSections/Search/ActionCell/PayActionCell.tsx @@ -64,6 +64,7 @@ function PayActionCell({isLoading, policyID, reportID, hash, amount, extraSmall, buttonSize={extraSmall ? CONST.DROPDOWN_BUTTON_SIZE.EXTRA_SMALL : CONST.DROPDOWN_BUTTON_SIZE.SMALL} currency={currency} formattedAmount={convertToDisplayString(Math.abs(iouReport?.total ?? 0), currency)} + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing policyID={policyID || iouReport?.policyID} iouReport={iouReport} chatReportID={iouReport?.chatReportID} diff --git a/src/components/SelectionListWithSections/UserListItem.tsx b/src/components/SelectionListWithSections/UserListItem.tsx index 4dbc2f907dce8..4562b9625bc82 100644 --- a/src/components/SelectionListWithSections/UserListItem.tsx +++ b/src/components/SelectionListWithSections/UserListItem.tsx @@ -57,6 +57,7 @@ function UserListItem({ } }, [item, onCheckboxPress, onSelectRow]); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const [isReportInOnyx] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${item.reportID}`, { selector: reportExistsSelector, }); @@ -131,6 +132,7 @@ function UserListItem({ isHovered && !isFocused ? StyleUtils.getBackgroundAndBorderStyle(hoveredBackgroundColor) : undefined, ]} reportID={reportExists ? item.reportID : undefined} + /* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */ accountIDs={!reportExists && !!itemAccountID ? [itemAccountID] : []} policyID={!reportExists && !!policyID ? policyID : undefined} singleAvatarContainerStyle={[styles.actionAvatar, styles.mr3]} diff --git a/src/components/SidePanel/HelpContent/helpContentMap.tsx b/src/components/SidePanel/HelpContent/helpContentMap.tsx index ab5c5c65f4d0e..69a6c12bdbcb6 100644 --- a/src/components/SidePanel/HelpContent/helpContentMap.tsx +++ b/src/components/SidePanel/HelpContent/helpContentMap.tsx @@ -1,4 +1,5 @@ /* eslint-disable react/jsx-key */ +/* eslint-disable react/no-unescaped-entities */ /* eslint-disable @typescript-eslint/naming-convention */ import type {ReactNode} from 'react'; import React from 'react'; diff --git a/src/components/TextInput/BaseTextInput/implementation/index.native.tsx b/src/components/TextInput/BaseTextInput/implementation/index.native.tsx index 8f08660339b69..7bd7d1b169f0a 100644 --- a/src/components/TextInput/BaseTextInput/implementation/index.native.tsx +++ b/src/components/TextInput/BaseTextInput/implementation/index.native.tsx @@ -258,6 +258,7 @@ function BaseTextInput({ const shouldAddPaddingBottom = isMultiline || (autoGrowHeight && !isAutoGrowHeightMarkdown && textInputHeight > variables.componentSizeLarge); const isReadOnly = inputProps.readOnly ?? inputProps.disabled; // Disabling this line for safeness as nullish coalescing works only if the value is undefined or null, and errorText can be an empty string + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const inputHelpText = errorText || hint; const placeholderValue = !!prefixCharacter || !!suffixCharacter || isFocused || !hasLabel || (hasLabel && forceActiveLabel) ? placeholder : undefined; const newTextInputContainerStyles: StyleProp = StyleSheet.flatten([ diff --git a/src/components/TextInput/BaseTextInput/implementation/index.tsx b/src/components/TextInput/BaseTextInput/implementation/index.tsx index ad44bfde794f0..0adb1eaa6049b 100644 --- a/src/components/TextInput/BaseTextInput/implementation/index.tsx +++ b/src/components/TextInput/BaseTextInput/implementation/index.tsx @@ -295,6 +295,7 @@ function BaseTextInput({ const hasLabel = !!label?.length; const isReadOnly = inputProps.readOnly ?? inputProps.disabled; // Disabling this line for safeness as nullish coalescing works only if the value is undefined or null, and errorText can be an empty string + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const inputHelpText = errorText || hint; const newPlaceholder = !!prefixCharacter || !!suffixCharacter || isFocused || !hasLabel || (hasLabel && forceActiveLabel) ? placeholder : undefined; // autoGrow uses autoGrowMeasurementStyles (includes padding), contentWidth doesn't - add padding manually diff --git a/src/components/TextInput/index.native.tsx b/src/components/TextInput/index.native.tsx index fba3051bb5a54..3dd1b0f47be41 100644 --- a/src/components/TextInput/index.native.tsx +++ b/src/components/TextInput/index.native.tsx @@ -35,6 +35,7 @@ function TextInput({ref, navigation, ...props}: BaseTextInputProps) { // eslint-disable-next-line react/jsx-props-no-spreading {...props} // Setting autoCompleteType to new-password throws an error on Android/iOS, so fall back to password in that case + // eslint-disable-next-line react/jsx-props-no-multi-spaces ref={ref} autoCompleteType={props.autoCompleteType === 'new-password' ? 'password' : props.autoCompleteType} inputStyle={[styles.baseTextInput, props.inputStyle]} diff --git a/src/components/TimePicker/TimePicker.tsx b/src/components/TimePicker/TimePicker.tsx index 9631938318af4..2dc4b46eab7e8 100644 --- a/src/components/TimePicker/TimePicker.tsx +++ b/src/components/TimePicker/TimePicker.tsx @@ -688,6 +688,7 @@ function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}, shou focusSecondInputOnLastCharacter(); } }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ selectionMinute.start, selectionMinute.end, diff --git a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx index cb10919f2c379..3cd2fcdbc2779 100644 --- a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -125,6 +125,7 @@ function BaseValidateCodeForm({ const inputValidateCodeRef = useRef(null); const [account = getEmptyObject()] = useOnyx(ONYXKEYS.ACCOUNT); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- nullish coalescing doesn't achieve the same result in this case const shouldDisableResendValidateCode = !!isOffline || account?.isLoading; const focusTimeoutRef = useRef(null); const [canShowError, setCanShowError] = useState(false); diff --git a/src/hooks/useDebugShortcut.tsx b/src/hooks/useDebugShortcut.tsx index 090c6cc5559be..7876d5dbc53fe 100644 --- a/src/hooks/useDebugShortcut.tsx +++ b/src/hooks/useDebugShortcut.tsx @@ -19,6 +19,7 @@ function useDebugShortcut() { }; // Rule disabled because this effect is only for component did mount & will component unmount lifecycle event + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); } diff --git a/src/hooks/useDefaultFundID.ts b/src/hooks/useDefaultFundID.ts index 2966cc9cb8c75..7db4a5876cb9a 100644 --- a/src/hooks/useDefaultFundID.ts +++ b/src/hooks/useDefaultFundID.ts @@ -20,6 +20,7 @@ function useDefaultFundID(policyID: string | undefined) { const getDomainFundID = useCallback( (cardSettings: OnyxCollection) => { const matchingKey = Object.entries(cardSettings ?? {}).find( + // eslint-disable-next-line @typescript-eslint/no-unused-vars ([key, settings]) => settings?.preferredPolicy && settings.preferredPolicy === policyID && !key.includes(workspaceAccountID.toString()), ); diff --git a/src/hooks/useHtmlPaste/index.ts b/src/hooks/useHtmlPaste/index.ts index bb8e945ac788f..59762bd600cd6 100644 --- a/src/hooks/useHtmlPaste/index.ts +++ b/src/hooks/useHtmlPaste/index.ts @@ -83,6 +83,7 @@ const useHtmlPaste: UseHtmlPaste = (textInputRef, preHtmlPasteCallback, isActive // eslint-disable-next-line no-empty } catch (e) {} // We only need to set the callback once. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [maxLength, textInputRef], ); diff --git a/src/hooks/useLazyAsset.ts b/src/hooks/useLazyAsset.ts index b81a0e9e96a45..87f4a89367b63 100644 --- a/src/hooks/useLazyAsset.ts +++ b/src/hooks/useLazyAsset.ts @@ -89,6 +89,7 @@ function useMemoizedLazyAsset(importFn: () => {default: T} const {asset, isLoaded} = useLazyAsset(stableImportFn, fallback); return { + // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style asset: (isLoaded ? asset : PlaceholderIcon) as T, }; } diff --git a/src/hooks/useReceiptScanDrop.tsx b/src/hooks/useReceiptScanDrop.tsx index eb2e9b59c1e25..bdb496b10c271 100644 --- a/src/hooks/useReceiptScanDrop.tsx +++ b/src/hooks/useReceiptScanDrop.tsx @@ -108,6 +108,7 @@ function useReceiptScanDrop() { return; } for (const file of files) { + // eslint-disable-next-line no-param-reassign -- Attach blob URI to file object for downstream receipt processing file.uri = URL.createObjectURL(file); } diff --git a/src/hooks/useSearchSelector.base.ts b/src/hooks/useSearchSelector.base.ts index d938d0ab21eac..76a4f6dbadaa3 100644 --- a/src/hooks/useSearchSelector.base.ts +++ b/src/hooks/useSearchSelector.base.ts @@ -326,7 +326,7 @@ function useSearchSelectorBase({ selectedOptions.some( (selected) => (selected.accountID && selected.accountID === option.accountID) || // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- this is boolean comparison - (selected.reportID && selected.reportID === option.reportID) || + (selected.reportID && selected.reportID === option.reportID) || // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- this is boolean comparison (selected.login && selected.login === option.login), ); }, [selectedOptions]); @@ -379,7 +379,7 @@ function useSearchSelectorBase({ const isSelected = selectedOptions.some( (selected) => (selected.accountID && selected.accountID === option.accountID) || // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- this is boolean comparison - (selected.reportID && selected.reportID === option.reportID) || + (selected.reportID && selected.reportID === option.reportID) || // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- this is boolean comparison (selected.login && selected.login === option.login), ); @@ -388,7 +388,7 @@ function useSearchSelectorBase({ (selected) => !( (selected.accountID && selected.accountID === option.accountID) || // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- this is boolean comparison - (selected.reportID && selected.reportID === option.reportID) || + (selected.reportID && selected.reportID === option.reportID) || // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing -- this is boolean comparison (selected.login && selected.login === option.login) ), ) diff --git a/src/hooks/useWorkletStateMachine/index.ts b/src/hooks/useWorkletStateMachine/index.ts index e3e038aeb7ea7..1b9b8ce76c93a 100644 --- a/src/hooks/useWorkletStateMachine/index.ts +++ b/src/hooks/useWorkletStateMachine/index.ts @@ -94,6 +94,7 @@ function useWorkletStateMachine, P>(stat return; } + // eslint-disable-next-line @typescript-eslint/unbound-method, @typescript-eslint/restrict-template-expressions client(`[StateMachine] ${message}. Params: ${JSON.stringify(params)}`); }, []); diff --git a/src/languages/en.ts b/src/languages/en.ts index 473f415ab4f49..c7f75fa244808 100644 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -132,6 +132,7 @@ type States = Record; type AllCountries = Record; +/* eslint-disable max-len */ const translations = { common: { // @context Used as a noun meaning a numerical total or quantity, not the verb “to count.” diff --git a/src/languages/es.ts b/src/languages/es.ts index bd00c0db309fa..66e6bb208e13d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -13,6 +13,7 @@ import type { } from './params'; import type {TranslationDeepObject} from './types'; +/* eslint-disable max-len */ const translations: TranslationDeepObject = { common: { count: 'Contar', diff --git a/src/languages/types.ts b/src/languages/types.ts index 3451d91310d62..afcea14b78a9e 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -21,6 +21,7 @@ type TranslationLeafValue = TStringOrFunction extends (...arg * Translation object is a recursive object that can contain other objects or string/function values */ type TranslationDeepObject = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any [Path in keyof TTranslations]: TTranslations[Path] extends string | ((...args: any[]) => any) ? TranslationLeafValue : TTranslations[Path] extends number | boolean | null | undefined | unknown[] diff --git a/src/libs/ContactPermission/useContactPermissions.ts b/src/libs/ContactPermission/useContactPermissions.ts index 87386a1196573..2ecd6569bc8e9 100644 --- a/src/libs/ContactPermission/useContactPermissions.ts +++ b/src/libs/ContactPermission/useContactPermissions.ts @@ -29,6 +29,7 @@ function useContactPermissions({importAndSaveContacts, setContacts, contactPermi } }) .catch((error) => { + // eslint-disable-next-line no-console console.error('Failed to check contact permission:', error); }); }, [contactPermissionState, importAndSaveContacts, setContacts, setContactPermissionState]); diff --git a/src/libs/CurrencyUtils.ts b/src/libs/CurrencyUtils.ts index dcf10415aaee2..9f23694e883ec 100644 --- a/src/libs/CurrencyUtils.ts +++ b/src/libs/CurrencyUtils.ts @@ -8,6 +8,7 @@ import {format, formatToParts} from './NumberFormatUtils'; let currencyList: OnyxValues[typeof ONYXKEYS.CURRENCY_LIST] = {}; +/* eslint-disable rulesdir/prefer-onyx-connect-in-libs -- may refactor to useOnyx/connectWithoutView later */ Onyx.connect({ key: ONYXKEYS.CURRENCY_LIST, callback: (val) => { @@ -18,6 +19,7 @@ Onyx.connect({ currencyList = val; }, }); +/* eslint-enable rulesdir/prefer-onyx-connect-in-libs */ /** * Returns the number of digits after the decimal separator for a specific currency. diff --git a/src/libs/DeviceCapabilities/hasPassiveEventListenerSupport/index.ts b/src/libs/DeviceCapabilities/hasPassiveEventListenerSupport/index.ts index 46a64e8919870..d3c6af0766af5 100644 --- a/src/libs/DeviceCapabilities/hasPassiveEventListenerSupport/index.ts +++ b/src/libs/DeviceCapabilities/hasPassiveEventListenerSupport/index.ts @@ -5,6 +5,7 @@ export default function hasPassiveEventListenerSupport(): boolean { let supportsPassive = false; try { const opts = Object.defineProperty({}, 'passive', { + // eslint-disable-next-line getter-return get() { supportsPassive = true; }, diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts index a76bbb0d20b47..db7712eab8909 100644 --- a/src/libs/DistanceRequestUtils.ts +++ b/src/libs/DistanceRequestUtils.ts @@ -428,6 +428,7 @@ function getRate({ const currency = isExpenseUnreported(transaction) ? transactionCurrency : policyCurrency; const defaultMileageRate = getDefaultMileageRate(policy); const customUnitRateID = getRateID(transaction); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const customMileageRate = (customUnitRateID && mileageRates?.[customUnitRateID]) || defaultMileageRate; const mileageRate = isCustomUnitRateIDForP2P(transaction) ? getRateForP2P(currency, transaction) : customMileageRate; const unit = getDistanceUnit(useTransactionDistanceUnit ? transaction : undefined, mileageRate); diff --git a/src/libs/ExportOnyxState/index.native.ts b/src/libs/ExportOnyxState/index.native.ts index 3629e885be26c..8e7e5ad04193b 100644 --- a/src/libs/ExportOnyxState/index.native.ts +++ b/src/libs/ExportOnyxState/index.native.ts @@ -25,6 +25,7 @@ const readFromOnyxDatabase: ReadFromOnyxDatabase = () => const result = // eslint-disable-next-line no-underscore-dangle rows?._array.reduce((acc, row) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access acc[row?.record_key] = JSON.parse(row?.valueJSON) as unknown; return acc; }, {}) ?? {}; diff --git a/src/libs/FormulaDatetime.ts b/src/libs/FormulaDatetime.ts index 64f151dd716f3..df73775db288b 100644 --- a/src/libs/FormulaDatetime.ts +++ b/src/libs/FormulaDatetime.ts @@ -29,6 +29,7 @@ function calculateISOWeekNumber(date: Date): number { // Set to nearest Thursday: current date + 4 - current day number // Make Sunday's day number 7 (getUTCDay returns 0 for Sunday) + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const dayNum = target.getUTCDay() || 7; target.setUTCDate(target.getUTCDate() + 4 - dayNum); diff --git a/src/libs/HeaderUtils.ts b/src/libs/HeaderUtils.ts index 1eef8417dd062..d8dcd05099922 100644 --- a/src/libs/HeaderUtils.ts +++ b/src/libs/HeaderUtils.ts @@ -24,4 +24,8 @@ function getShareMenuItem(report: OnyxReport, backTo?: string): ThreeDotsMenuIte }; } -export {getPinMenuItem, getShareMenuItem}; +export { + // eslint-disable-next-line import/prefer-default-export + getPinMenuItem, + getShareMenuItem, +}; diff --git a/src/libs/LocalePhoneNumber.ts b/src/libs/LocalePhoneNumber.ts index 25f81ce0e03e1..1b389643a52e7 100644 --- a/src/libs/LocalePhoneNumber.ts +++ b/src/libs/LocalePhoneNumber.ts @@ -5,6 +5,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import {parsePhoneNumber} from './PhoneNumber'; let countryCodeByIPOnyx: number; +// eslint-disable-next-line rulesdir/prefer-onyx-connect-in-libs -- may refactor to useOnyx/connectWithoutView later Onyx.connect({ key: ONYXKEYS.COUNTRY_CODE, callback: (val) => (countryCodeByIPOnyx = val ?? 1), @@ -83,4 +84,8 @@ function formatPhoneNumberWithCountryCode(number: string, countryCodeByIP: numbe return parsedPhoneNumber.number.international; } -export {formatPhoneNumber, formatPhoneNumberWithCountryCode}; +export { + // eslint-disable-next-line import/prefer-default-export + formatPhoneNumber, + formatPhoneNumberWithCountryCode, +}; diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index eedd11f58e6cc..7a6cd5cf8cef2 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -104,6 +104,7 @@ function getTranslatedPhrase(language: Locale, ph const memoizedGetTranslatedPhrase = memoize(getTranslatedPhrase, { maxArgs: 2, equality: 'shallow', + // eslint-disable-next-line @typescript-eslint/no-unused-vars skipCache: (params) => params.length > 2, }); @@ -141,6 +142,7 @@ function translate(locale: Locale | undefined, p * Uses the locale in this file updated by the Onyx subscriber. * @deprecated This function uses imperative Onyx data access patterns, similar to `Onyx.connect`. Use `useLocalize` hook instead for reactive data access in React components. */ +// eslint-disable-next-line @typescript-eslint/no-deprecated function translateLocal(phrase: TPath, ...parameters: TranslationParameters) { const currentLocale = IntlStore.getCurrentLocale(); return translate(currentLocale, phrase, ...parameters); @@ -197,4 +199,5 @@ function getDevicePreferredLocale(): Locale { return RNLocalize.findBestLanguageTag(Object.values(CONST.LOCALES))?.languageTag ?? CONST.LOCALES.DEFAULT; } +// eslint-disable-next-line @typescript-eslint/no-deprecated export {translate, translateLocal, formatList, formatMessageElementList, getDevicePreferredLocale}; diff --git a/src/libs/Log.ts b/src/libs/Log.ts index 316900f1bba30..94490ad21388e 100644 --- a/src/libs/Log.ts +++ b/src/libs/Log.ts @@ -1,5 +1,6 @@ // Making an exception to this rule here since we don't need an "action" for Log and Log should just be used directly. Creating a Log // action would likely cause confusion about which one to use. But most other API methods should happen inside an action file. +/* eslint-disable rulesdir/no-api-in-views */ import HybridAppModule from '@expensify/react-native-hybrid-app'; import {Logger} from 'expensify-common'; import AppLogs from 'react-native-app-logs'; diff --git a/src/libs/Middleware/Logging.ts b/src/libs/Middleware/Logging.ts index 1affa4b97a4b9..35d32caa5a4ac 100644 --- a/src/libs/Middleware/Logging.ts +++ b/src/libs/Middleware/Logging.ts @@ -14,6 +14,7 @@ function getCircularReplacer() { return value; } // `this` is the object that value is contained in, i.e the direct parent + // eslint-disable-next-line no-invalid-this while (ancestors.length > 0 && ancestors.at(-1) !== this) { ancestors.pop(); } diff --git a/src/libs/ModifiedExpenseMessage.ts b/src/libs/ModifiedExpenseMessage.ts index d0396d4570cff..a3b72f7998afe 100644 --- a/src/libs/ModifiedExpenseMessage.ts +++ b/src/libs/ModifiedExpenseMessage.ts @@ -501,21 +501,46 @@ function getForReportAction({ const oldBillable = reportActionOriginalMessage?.oldBillable === 'billable' ? translateLocal('common.billable').toLowerCase() : translateLocal('common.nonBillable').toLowerCase(); // eslint-disable-next-line @typescript-eslint/no-deprecated const newBillable = reportActionOriginalMessage?.billable === 'billable' ? translateLocal('common.billable').toLowerCase() : translateLocal('common.nonBillable').toLowerCase(); - buildMessageFragmentForValue(translateLocal, newBillable, oldBillable, translateLocal('iou.expense'), true, setFragments, removalFragments, changeFragments); + buildMessageFragmentForValue( + // eslint-disable-next-line @typescript-eslint/no-deprecated + translateLocal, + newBillable, + oldBillable, + // eslint-disable-next-line @typescript-eslint/no-deprecated + translateLocal('iou.expense'), + true, + setFragments, + removalFragments, + changeFragments, + ); } const hasModifiedReimbursable = isReportActionOriginalMessageAnObject && 'oldReimbursable' in reportActionOriginalMessage && 'reimbursable' in reportActionOriginalMessage; if (hasModifiedReimbursable) { const oldReimbursable = + // eslint-disable-next-line @typescript-eslint/no-deprecated reportActionOriginalMessage?.oldReimbursable === 'reimbursable' ? translateLocal('iou.reimbursable').toLowerCase() : translateLocal('iou.nonReimbursable').toLowerCase(); const newReimbursable = + // eslint-disable-next-line @typescript-eslint/no-deprecated reportActionOriginalMessage?.reimbursable === 'reimbursable' ? translateLocal('iou.reimbursable').toLowerCase() : translateLocal('iou.nonReimbursable').toLowerCase(); - buildMessageFragmentForValue(translateLocal, newReimbursable, oldReimbursable, translateLocal('iou.expense'), true, setFragments, removalFragments, changeFragments); + buildMessageFragmentForValue( + // eslint-disable-next-line @typescript-eslint/no-deprecated + translateLocal, + newReimbursable, + oldReimbursable, + // eslint-disable-next-line @typescript-eslint/no-deprecated + translateLocal('iou.expense'), + true, + setFragments, + removalFragments, + changeFragments, + ); } const hasModifiedAttendees = isReportActionOriginalMessageAnObject && 'oldAttendees' in reportActionOriginalMessage && 'newAttendees' in reportActionOriginalMessage; if (hasModifiedAttendees) { const [oldAttendees, attendees] = getFormattedAttendees(reportActionOriginalMessage.newAttendees, reportActionOriginalMessage.oldAttendees); + // eslint-disable-next-line @typescript-eslint/no-deprecated buildMessageFragmentForValue(translateLocal, oldAttendees, attendees, translateLocal('iou.attendees'), false, setFragments, removalFragments, changeFragments); } @@ -523,6 +548,7 @@ function getForReportAction({ if (hasPersonalRulesModifiedFields) { const personalRulesModifiedFields = reportActionOriginalMessage.personalRulesModifiedFields; if (personalRulesModifiedFields) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return getRulesModifiedMessage(translateLocal, personalRulesModifiedFields, true); } } @@ -533,24 +559,31 @@ function getForReportAction({ const policyRulesModifiedFields = reportActionOriginalMessage.policyRulesModifiedFields; if (policyRulesModifiedFields && rulePolicyID) { + // eslint-disable-next-line @typescript-eslint/no-deprecated const rulePolicy = getPolicy(rulePolicyID); const hasPolicyRuleAccess = !!rulePolicy?.areRulesEnabled && isPolicyAdmin(rulePolicy, currentUserLogin); + // eslint-disable-next-line @typescript-eslint/no-deprecated return getRulesModifiedMessage(translateLocal, policyRulesModifiedFields, false, rulePolicyID, hasPolicyRuleAccess); } } const message = + // eslint-disable-next-line @typescript-eslint/no-deprecated getMessageLine(translateLocal, `\n${translateLocal('iou.changed')}`, changeFragments) + + // eslint-disable-next-line @typescript-eslint/no-deprecated getMessageLine(translateLocal, `\n${translateLocal('iou.set')}`, setFragments) + + // eslint-disable-next-line @typescript-eslint/no-deprecated getMessageLine(translateLocal, `\n${translateLocal('iou.removed')}`, removalFragments); if (message === '') { // If we don't have enough structured information to build a detailed message but we // know the change was AI-generated, fall back to an AI-attributed generic summary so // users can still understand that Concierge updated the expense automatically. if (reportActionOriginalMessage?.aiGenerated) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return `${translateLocal('iou.changedTheExpense')} ${translateLocal('iou.basedOnAI')}`; } + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.changedTheExpense'); } return `${message.substring(1, message.length)}`; diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 049abd90e0dfa..ca51369ebe933 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -257,6 +257,7 @@ function AuthScreens() { } // This means sign in in RHP was successful, so we can subscribe to user events initializePusher(session?.accountID); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [session?.accountID]); useAutoUpdateTimezone(); diff --git a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/convertToWebNavigationOptions.ts b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/convertToWebNavigationOptions.ts index e346e7df86a64..358077a2f3925 100644 --- a/src/libs/Navigation/PlatformStackNavigation/navigationOptions/convertToWebNavigationOptions.ts +++ b/src/libs/Navigation/PlatformStackNavigation/navigationOptions/convertToWebNavigationOptions.ts @@ -10,6 +10,7 @@ function convertToWebNavigationOptions(screenOptions: ScreenOptionsOrCallback) => { const routeBasedScreenOptions = screenOptions(props); return {...buildPlatformSpecificNavigationOptions(routeBasedScreenOptions), ...routeBasedScreenOptions.web}; diff --git a/src/libs/Navigation/helpers/replacePathInNestedState.ts b/src/libs/Navigation/helpers/replacePathInNestedState.ts index dd248f927382d..b8de47fc42f90 100644 --- a/src/libs/Navigation/helpers/replacePathInNestedState.ts +++ b/src/libs/Navigation/helpers/replacePathInNestedState.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import {findFocusedRoute} from '@react-navigation/native'; import type {NavigationState, PartialState} from '@react-navigation/native'; import type {RootNavigatorParamList} from '@libs/Navigation/types'; diff --git a/src/libs/Navigation/linkingConfig/index.ts b/src/libs/Navigation/linkingConfig/index.ts index 35832795e9002..4eec394d5bcbb 100644 --- a/src/libs/Navigation/linkingConfig/index.ts +++ b/src/libs/Navigation/linkingConfig/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import type {LinkingOptions} from '@react-navigation/native'; import getAdaptedStateFromPath from '@libs/Navigation/helpers/getAdaptedStateFromPath'; import type {RootNavigatorParamList} from '@libs/Navigation/types'; diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 74ef5796c9f05..10bba5849f93e 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import type { CommonActions, NavigationContainerRefWithCurrent, @@ -1861,6 +1862,7 @@ type MoneyRequestNavigatorParamList = { iouType: IOUType; reportID: string; // eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md + // eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md backTo: Routes | undefined; action: IOUAction; pageIndex: string; @@ -2831,6 +2833,7 @@ type SharedScreensParamList = { shortLivedAuthToken?: string; shortLivedToken?: string; authTokenType?: ValueOf; + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents exitTo?: Routes; shouldForceLogin: string; domain?: Routes; @@ -2840,6 +2843,7 @@ type SharedScreensParamList = { [SCREENS.VALIDATE_LOGIN]: { accountID: string; validateCode: string; + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents exitTo?: Routes; }; }; diff --git a/src/libs/Network/MainQueue.ts b/src/libs/Network/MainQueue.ts index 35b80704d1afa..2cf72456616b0 100644 --- a/src/libs/Network/MainQueue.ts +++ b/src/libs/Network/MainQueue.ts @@ -24,6 +24,7 @@ function push(request: OnyxRequest) { function replay(request: OnyxRequest) { push(request); + // eslint-disable-next-line @typescript-eslint/no-use-before-define process(); } diff --git a/src/libs/NumberUtils.ts b/src/libs/NumberUtils.ts index 4c5cec59fb028..19ff746a48d58 100644 --- a/src/libs/NumberUtils.ts +++ b/src/libs/NumberUtils.ts @@ -6,7 +6,9 @@ function rand64(): string { // Generate two BigInts that are each 32-bit random numbers. // We do 2 because Math.random() really only generates 53-bit numbers internally. + // eslint-disable-next-line no-bitwise const hi32 = BigInt(Math.floor(Math.random() * 0x100000000)); + // eslint-disable-next-line no-bitwise const lo32 = BigInt(Math.floor(Math.random() * 0x100000000)); // Combine the two into a single 64-bit value. diff --git a/src/libs/ObjectUtils.ts b/src/libs/ObjectUtils.ts index 1f3fe18fb153f..0a23693f2ba7d 100644 --- a/src/libs/ObjectUtils.ts +++ b/src/libs/ObjectUtils.ts @@ -28,4 +28,5 @@ function filterObject>(obj: TObject, pre }, {} as TObject); } +// eslint-disable-next-line import/prefer-default-export export {shallowCompare, filterObject}; diff --git a/src/libs/OptionsListUtils/index.ts b/src/libs/OptionsListUtils/index.ts index 44ca3184a701e..937dbb0394537 100644 --- a/src/libs/OptionsListUtils/index.ts +++ b/src/libs/OptionsListUtils/index.ts @@ -443,6 +443,7 @@ function getAlternateText( const isAnnounceRoom = reportUtilsIsAnnounceRoom(report); const isGroupChat = reportUtilsIsGroupChat(report); const isExpenseThread = isMoneyRequest(report); + // eslint-disable-next-line @typescript-eslint/no-deprecated const translateFn = translate ?? translateLocal; const formattedLastMessageText = formatReportLastMessageText(Parser.htmlToText(option.lastMessageText ?? '')) || @@ -460,10 +461,12 @@ function getAlternateText( const formattedLastMessageTextWithPrefix = reportPrefix + formattedLastMessageText; if (isExpenseThread || option.isMoneyRequestReport) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageTextWithPrefix : translateFn('iou.expense'); } if (option.isThread) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageTextWithPrefix : translateFn('threads.thread'); } @@ -476,10 +479,12 @@ function getAlternateText( } if (option.isTaskReport) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageTextWithPrefix : translateFn('task.task'); } if (isGroupChat) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return showChatPreviewLine && formattedLastMessageText ? formattedLastMessageTextWithPrefix : translateFn('common.group'); } @@ -1033,6 +1038,7 @@ function createOption( // If displaying chat preview line is needed, let's overwrite the default alternate text const lastActorDetails = personalDetails?.[report?.lastActorAccountID ?? String(CONST.DEFAULT_NUMBER_ID)] ?? {}; const currentUserLogin = personalDetails?.[currentUserAccountID]?.login ?? ''; + // eslint-disable-next-line @typescript-eslint/no-deprecated const translateFn = translate ?? translateLocal; result.lastMessageText = getLastMessageTextForReport({ translate: translateFn, @@ -1064,6 +1070,7 @@ function createOption( ? getDisplayNameForParticipant({accountID: accountIDs.at(0), formatPhoneNumber: formatPhoneNumberPhoneUtils}) || formatPhoneNumberPhoneUtils(personalDetail?.login ?? '') : computedReportName; } else { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing reportName = getDisplayNameForParticipant({accountID: accountIDs.at(0), personalDetailsData: personalDetails ?? undefined, formatPhoneNumber: formatPhoneNumberPhoneUtils}) || formatPhoneNumberPhoneUtils(personalDetail?.login ?? ''); @@ -1132,12 +1139,15 @@ function getReportOption( // Update text & alternateText because createOption returns workspace name only if report is owned by the user if (option.isSelfDM) { + // eslint-disable-next-line @typescript-eslint/no-deprecated option.alternateText = translateLocal('reportActionsView.yourSpace'); } else if (option.isInvoiceRoom) { option.text = getReportName(report, reportAttributesDerived); + // eslint-disable-next-line @typescript-eslint/no-deprecated option.alternateText = translateLocal('workspace.common.invoices'); } else { option.text = getPolicyName({report}); + // eslint-disable-next-line @typescript-eslint/no-deprecated option.alternateText = translateLocal('workspace.common.workspace'); if (report?.policyID) { @@ -1146,6 +1156,7 @@ function getReportOption( const subtitle = submitsToAccountDetails?.displayName ?? submitsToAccountDetails?.login; if (subtitle) { + // eslint-disable-next-line @typescript-eslint/no-deprecated option.alternateText = translateLocal('iou.submitsTo', subtitle ?? ''); } } @@ -1189,9 +1200,11 @@ function getReportDisplayOption( // Update text & alternateText because createOption returns workspace name only if report is owned by the user if (option.isSelfDM) { + // eslint-disable-next-line @typescript-eslint/no-deprecated option.alternateText = translateLocal('reportActionsView.yourSpace'); } else if (option.isInvoiceRoom) { option.text = getReportName(report, reportAttributesDerived); + // eslint-disable-next-line @typescript-eslint/no-deprecated option.alternateText = translateLocal('workspace.common.invoices'); } else if (unknownUserDetails) { option.text = unknownUserDetails.text ?? unknownUserDetails.login; @@ -1199,6 +1212,7 @@ function getReportDisplayOption( option.participantsList = [{...unknownUserDetails, displayName: unknownUserDetails.login, accountID: unknownUserDetails.accountID ?? CONST.DEFAULT_NUMBER_ID}]; } else if (report?.ownerAccountID !== 0 || !option.text) { option.text = getPolicyName({report}); + // eslint-disable-next-line @typescript-eslint/no-deprecated option.alternateText = translateLocal('workspace.common.workspace'); } option.isDisabled = true; @@ -1240,6 +1254,7 @@ function getPolicyExpenseReportOption( // Update text & alternateText because createOption returns workspace name only if report is owned by the user option.text = getPolicyName({report: expenseReport}); + // eslint-disable-next-line @typescript-eslint/no-deprecated option.alternateText = translateLocal('workspace.common.workspace'); option.isSelected = participant.selected; option.selected = participant.selected; // Keep for backwards compatibility @@ -1312,6 +1327,7 @@ function isMakingLastRequiredTagListOptional(policy: Policy | undefined, policyT } function getSearchValueForPhoneOrEmail(searchTerm: string, countryCode: number) { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const parsedPhoneNumber = parsePhoneNumber(appendCountryCode(Str.removeSMSDomain(searchTerm), countryCode)); return parsedPhoneNumber.possible ? (parsedPhoneNumber.number?.e164 ?? '') : searchTerm.toLowerCase(); } @@ -1971,9 +1987,11 @@ function getUserToInviteContactOption({ currentUserEmail, }: GetUserToInviteConfig): SearchOption | null { // If email is provided, use it as the primary identifier + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const effectiveSearchValue = email || searchValue; // Handle phone number parsing for either provided phone or searchValue + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const phoneToCheck = phone || searchValue; const normalizedPhoneNumber = appendCountryCode(Str.removeSMSDomain(phoneToCheck), countryCode); const parsedPhoneNumber = parsePhoneNumber(normalizedPhoneNumber); @@ -2000,11 +2018,13 @@ function getUserToInviteContactOption({ const optimisticAccountID = generateAccountID(login); // Construct display name if firstName/lastName are provided + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const displayName = firstName && lastName ? `${firstName} ${lastName}` : firstName || lastName || effectiveSearchValue; // Create the base user details that will be used in both item and participantsList const userDetails = { accountID: optimisticAccountID, + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing avatar: avatar || FallbackAvatar, firstName: firstName ?? '', lastName: lastName ?? '', @@ -2287,6 +2307,7 @@ function prepareReportOptionsForDisplay( if (shouldSeparateWorkspaceChat && newReportOption.isPolicyExpenseChat && !newReportOption.private_isArchived) { newReportOption.text = getPolicyName({report}); + // eslint-disable-next-line @typescript-eslint/no-deprecated newReportOption.alternateText = translateLocal('workspace.common.workspace'); if (report?.policyID) { @@ -2296,6 +2317,7 @@ function prepareReportOptionsForDisplay( const subtitle = submitsToAccountDetails?.displayName ?? submitsToAccountDetails?.login; if (subtitle) { + // eslint-disable-next-line @typescript-eslint/no-deprecated newReportOption.alternateText = translateLocal('iou.submitsTo', subtitle ?? ''); } const canSubmitPerDiemExpense = canSubmitPerDiemExpenseFromWorkspace(policy); @@ -2764,6 +2786,7 @@ function getFilteredRecentAttendees( .map((attendee) => ({ ...attendee, // Use || instead of ?? to handle empty string email for name-only attendees + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing login: attendee.email || attendee.displayName, ...getPersonalDetailByEmail(attendee.email), keyForList: `${currentUserAccountID}`, @@ -2787,6 +2810,7 @@ function formatMemberForList(member: SearchOptionData): MemberForList { text: member.text || member.displayName || '', // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing alternateText: member.alternateText || member.login || '', + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing keyForList: member.keyForList || String(accountID ?? CONST.DEFAULT_NUMBER_ID) || '', isSelected: member.isSelected ?? false, isDisabled: member.isDisabled ?? false, @@ -2836,6 +2860,7 @@ function getHeaderMessage(hasSelectableOptions: boolean, hasUserToInvite: boolea const isValidEmail = Str.isValidEmail(searchValue); if (searchValue && CONST.REGEX.DIGITS_AND_PLUS.test(searchValue) && !isValidPhone && !hasSelectableOptions) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('messages.errorMessageInvalidPhone'); } @@ -2843,14 +2868,17 @@ function getHeaderMessage(hasSelectableOptions: boolean, hasUserToInvite: boolea // Therefore, this skips the validation when there is no search value. if (searchValue && !hasSelectableOptions && !hasUserToInvite) { if (/^\d+$/.test(searchValue) && !isValidPhone) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('messages.errorMessageInvalidPhone'); } if (/@/.test(searchValue) && !isValidEmail) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('messages.errorMessageInvalidEmail'); } if (hasMatchedParticipant && (isValidEmail || isValidPhone)) { return ''; } + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('common.noResultsFound'); } @@ -2862,6 +2890,7 @@ function getHeaderMessage(hasSelectableOptions: boolean, hasUserToInvite: boolea */ function getHeaderMessageForNonUserList(hasSelectableOptions: boolean, searchValue: string): string { if (searchValue && !hasSelectableOptions) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('common.noResultsFound'); } return ''; @@ -2965,6 +2994,7 @@ function getPersonalDetailSearchTerms(item: Partial, currentUs } function getCurrentUserSearchTerms(item: Partial) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return [item.text ?? item.displayName ?? '', item.login ?? '', item.login?.replace(CONST.EMAIL_SEARCH_REGEX, '') ?? '', translateLocal('common.you'), translateLocal('common.me')]; } @@ -3141,6 +3171,7 @@ function filterOptions( const trimmedSearchInput = searchInputValue.trim(); const searchInputValueForInvite = config?.searchInputValue ?? trimmedSearchInput; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const parsedPhoneNumber = parsePhoneNumber(appendCountryCode(Str.removeSMSDomain(trimmedSearchInput), countryCode || CONST.DEFAULT_COUNTRY_CODE)); const searchValue = parsedPhoneNumber.possible && parsedPhoneNumber.number?.e164 ? parsedPhoneNumber.number.e164 : trimmedSearchInput.toLowerCase(); const searchTerms = searchValue ? searchValue.split(' ') : []; diff --git a/src/libs/PersonalDetailsUtils.ts b/src/libs/PersonalDetailsUtils.ts index 0b20c0b301244..11bfaf777afeb 100644 --- a/src/libs/PersonalDetailsUtils.ts +++ b/src/libs/PersonalDetailsUtils.ts @@ -358,6 +358,7 @@ function createDisplayName( */ function extractFirstAndLastNameFromAvailableDetails({login, displayName, firstName, lastName}: PersonalDetails): FirstAndLastName { // It's possible for firstName to be empty string, so we must use "||" to consider lastName instead. + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (firstName || lastName) { return {firstName: firstName ?? '', lastName: lastName ?? ''}; } diff --git a/src/libs/PhoneNumber.ts b/src/libs/PhoneNumber.ts index da5394825fb87..af17f6cf9b053 100644 --- a/src/libs/PhoneNumber.ts +++ b/src/libs/PhoneNumber.ts @@ -68,4 +68,5 @@ function addSMSDomainIfPhoneNumber(login = ''): string { return login; } +// eslint-disable-next-line import/prefer-default-export export {parsePhoneNumber, addSMSDomainIfPhoneNumber}; diff --git a/src/libs/ReceiptUtils.ts b/src/libs/ReceiptUtils.ts index 09bd9ddd74f52..dceabfe0ca4f6 100644 --- a/src/libs/ReceiptUtils.ts +++ b/src/libs/ReceiptUtils.ts @@ -94,5 +94,6 @@ const shouldValidateFile = (file: ShareTempFile | undefined) => { return file?.mimeType === CONST.SHARE_FILE_MIMETYPE.HEIC || file?.mimeType === CONST.SHARE_FILE_MIMETYPE.IMG; }; +// eslint-disable-next-line import/prefer-default-export export {getThumbnailAndImageURIs, shouldValidateFile, constructReceiptSourceFromFilename}; export type {ThumbnailAndImageURI}; diff --git a/src/libs/ReportNameUtils.ts b/src/libs/ReportNameUtils.ts index 72f53786e785b..f22c3d83229c9 100644 --- a/src/libs/ReportNameUtils.ts +++ b/src/libs/ReportNameUtils.ts @@ -258,9 +258,11 @@ function getPolicyExpenseChatName({report, personalDetailsList}: {report: OnyxEn const ownerAccountID = report?.ownerAccountID; const personalDetails = ownerAccountID ? personalDetailsList?.[ownerAccountID] : undefined; const login = personalDetails ? personalDetails.login : null; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const reportOwnerDisplayName = getDisplayNameForParticipant({accountID: ownerAccountID, shouldRemoveDomain: true, formatPhoneNumber: formatPhoneNumberPhoneUtils}) || login; if (reportOwnerDisplayName) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('workspace.common.policyExpenseChatName', reportOwnerDisplayName); } @@ -350,22 +352,27 @@ function getMoneyRequestReportName({report, policy, invoiceReceiverPolicy}: {rep } else { payerOrApproverName = getDisplayNameForParticipant({accountID: report?.managerID, formatPhoneNumber: formatPhoneNumberPhoneUtils}) ?? ''; } + // eslint-disable-next-line @typescript-eslint/no-deprecated const payerPaidAmountMessage = translateLocal('iou.payerPaidAmount', formattedAmount, payerOrApproverName); if (isReportApproved({report})) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.managerApprovedAmount', payerOrApproverName, formattedAmount); } if (report?.isWaitingOnBankAccount) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return `${payerPaidAmountMessage} ${CONST.DOT_SEPARATOR} ${translateLocal('iou.pending')}`; } if (!isSettled(report?.reportID) && hasNonReimbursableTransactions(report?.reportID)) { payerOrApproverName = getDisplayNameForParticipant({accountID: report?.ownerAccountID, formatPhoneNumber: formatPhoneNumberPhoneUtils}) ?? ''; + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.payerSpentAmount', formattedAmount, payerOrApproverName); } if (isProcessingReport(report) || isOpenExpenseReport(report) || isOpenInvoiceReport(report) || moneyRequestTotal === 0) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.payerOwesAmount', formattedAmount, payerOrApproverName); } @@ -766,6 +773,7 @@ function computeReportName( const parentReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`]; const parentReportAction = isThread(report) ? reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`]?.[report.parentReportActionID] : undefined; + // eslint-disable-next-line @typescript-eslint/no-deprecated const parentReportActionBasedName = computeReportNameBasedOnReportAction(translateLocal, parentReportAction, report, reportPolicy, parentReport); if (parentReportActionBasedName) { @@ -780,6 +788,7 @@ function computeReportName( const {originalID} = getOriginalMessage(parentReportAction) ?? {}; const originalReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${originalID}`]; const reportName = computeReportName(originalReport, reports, policies, transactions, allReportNameValuePairs, personalDetailsList, reportActions, currentUserAccountID); + // eslint-disable-next-line @typescript-eslint/no-deprecated return getCreatedReportForUnapprovedTransactionsMessage(originalID, reportName, isOriginalReportDeleted(parentReportAction, originalReport), translateLocal); } @@ -791,6 +800,7 @@ function computeReportName( const privateIsArchivedValue = privateIsArchived ?? allReportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`]?.private_isArchived; + // eslint-disable-next-line @typescript-eslint/no-deprecated const chatThreadReportName = computeChatThreadReportName(translateLocal, !!privateIsArchivedValue, report, reports ?? {}, parentReportAction); if (chatThreadReportName) { return chatThreadReportName; @@ -798,6 +808,7 @@ function computeReportName( const transactionsArray = transactions ? (Object.values(transactions).filter(Boolean) as Array>) : undefined; if (isClosedExpenseReportWithNoExpenses(report, transactionsArray)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('parentReportAction.deletedReport'); } diff --git a/src/libs/ReportPreviewActionUtils.ts b/src/libs/ReportPreviewActionUtils.ts index 95990894fb7a1..bc13ac1d91977 100644 --- a/src/libs/ReportPreviewActionUtils.ts +++ b/src/libs/ReportPreviewActionUtils.ts @@ -215,6 +215,7 @@ function getReportPreviewAction({ } // We want to have action displayed for either paid or approved animations + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (isPaidAnimationRunning || isApprovedAnimationRunning) { return CONST.REPORT.REPORT_PREVIEW_ACTIONS.PAY; } diff --git a/src/libs/ReportPrimaryActionUtils.ts b/src/libs/ReportPrimaryActionUtils.ts index cf11e20a53aea..2bea12909a348 100644 --- a/src/libs/ReportPrimaryActionUtils.ts +++ b/src/libs/ReportPrimaryActionUtils.ts @@ -436,6 +436,7 @@ function getReportPrimaryAction(params: GetReportPrimaryActionParams): ValueOf, isReportAr /** * Whether the provided report is an archived report */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars function isArchivedReport(reportNameValuePairs?: OnyxInputOrEntry): boolean { return !!reportNameValuePairs?.private_isArchived; } @@ -2413,6 +2414,7 @@ function isJoinRequestInAdminRoom(report: OnyxEntry): boolean { // since they are not a part of the company, and should not action it on their behalf. if (report.policyID) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(report.policyID); if (!isExpensifyTeam(policy?.owner) && isExpensifyTeam(currentUserPersonalDetails?.login)) { return false; @@ -2427,6 +2429,7 @@ function isJoinRequestInAdminRoom(report: OnyxEntry): boolean { function isAuditor(report: OnyxEntry): boolean { if (report?.policyID) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(report.policyID); return isPolicyAuditor(policy); } @@ -2677,6 +2680,7 @@ function isOneTransactionThread(report: OnyxEntry, parentReport: OnyxEnt * Checks if given report is a transaction thread */ function isReportTransactionThread(report: OnyxEntry) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return isMoneyRequest(report) || isTrackExpenseReport(report); } @@ -2837,6 +2841,7 @@ function canAddTransaction(moneyRequestReport: OnyxEntry, isReportArchiv } // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(moneyRequestReport?.policyID); if (isExpenseReport(moneyRequestReport) && (!isCurrentUserSubmitter(moneyRequestReport) || !isPaidGroupPolicyPolicyUtils(policy))) { @@ -2908,6 +2913,7 @@ function hasOutstandingChildRequest( ) { const reportActions = getAllReportActions(chatReport.reportID); // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(chatReport.policyID); return Object.values(reportActions).some((action) => { const iouReportID = getIOUReportIDFromReportActionPreview(action); @@ -2939,6 +2945,7 @@ function hasOutstandingChildRequest( const canSubmit = !hasAutoRejectedTransactionsForManager && canSubmitReport(iouReport, policy, transactions, undefined, false, currentUserEmailParam, currentUserAccountIDParam); const invoiceReceiverPolicyID = chatReport?.invoiceReceiver && 'policyID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.policyID : undefined; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const invoiceReceiverPolicy = getPolicy(invoiceReceiverPolicyID); return ( canIOUBePaid(iouReport, chatReport, policy, bankAccountList, transactions, undefined, undefined, invoiceReceiverPolicy) || @@ -3566,6 +3573,7 @@ function getInvoiceReceiverIcons(report: OnyxInputOrEntry, personalDetai const receiverPolicyID = report?.invoiceReceiver?.policyID; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID); if (!isEmptyObject(receiverPolicy)) { return [ @@ -3781,6 +3789,7 @@ function getIconsForInvoiceReport( const receiverPolicyID = invoiceRoomReport?.invoiceReceiver?.policyID; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID); if (!isEmptyObject(receiverPolicy)) { @@ -3920,6 +3929,7 @@ function getDisplayNamesWithTooltips( return personalDetailsListArray .map((user) => { const accountID = Number(user?.accountID); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const displayName = getDisplayNameForParticipant({accountID, shouldUseShortForm, shouldFallbackToHidden, shouldAddCurrentUserPostfix, formatPhoneNumber}) || // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing @@ -3930,6 +3940,7 @@ function getDisplayNamesWithTooltips( let pronouns = user?.pronouns ?? undefined; if (pronouns?.startsWith(CONST.PRONOUNS.PREFIX)) { const pronounTranslationKey = pronouns.replace(CONST.PRONOUNS.PREFIX, ''); + // eslint-disable-next-line @typescript-eslint/no-deprecated pronouns = translateLocal(`pronouns.${pronounTranslationKey}` as TranslationPaths); } @@ -3969,9 +3980,11 @@ function getUserDetailTooltipText(accountID: number, formatPhoneNumber: LocaleCo */ function getDeletedParentActionMessageForChatReport(reportAction: OnyxEntry): string { // By default, let us display [Deleted message] + // eslint-disable-next-line @typescript-eslint/no-deprecated let deletedMessageText = translateLocal('parentReportAction.deletedMessage'); if (isCreatedTaskReportAction(reportAction)) { // For canceled task report, let us display [Deleted task] + // eslint-disable-next-line @typescript-eslint/no-deprecated deletedMessageText = translateLocal('parentReportAction.deletedTask'); } return deletedMessageText; @@ -4259,6 +4272,7 @@ function getReasonAndReportActionThatRequiresAttention( const optionReportMetadata = allReportMetadata?.[`${ONYXKEYS.COLLECTION.REPORT_METADATA}${optionOrReport.reportID}`]; const invoiceReceiverPolicyID = optionOrReport?.invoiceReceiver && 'policyID' in optionOrReport.invoiceReceiver ? optionOrReport.invoiceReceiver.policyID : undefined; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const invoiceReceiverPolicy = invoiceReceiverPolicyID ? getPolicy(invoiceReceiverPolicyID) : undefined; const iouReportActionToApproveOrPay = getIOUReportActionToApproveOrPay(optionOrReport, undefined, optionReportMetadata, invoiceReceiverPolicy); const iouReportID = getIOUReportIDFromReportActionPreview(iouReportActionToApproveOrPay); @@ -4267,6 +4281,7 @@ function getReasonAndReportActionThatRequiresAttention( // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(optionOrReport.policyID); if ( (optionOrReport.hasOutstandingChildRequest === true || iouReportActionToApproveOrPay?.reportActionID) && @@ -4685,6 +4700,7 @@ function canEditMoneyRequest( return isSubmitted && isRequestor; } // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const reportPolicy = policy ?? getPolicy(moneyRequestReport?.policyID); const isAdmin = reportPolicy?.role === CONST.POLICY.ROLE.ADMIN; const isManager = currentUserAccountID === moneyRequestReport?.managerID; @@ -4708,6 +4724,7 @@ function canEditMoneyRequest( function getNextApproverAccountID(report: OnyxEntry, isUnapproved = false) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(report?.policyID); // If the current user took control, then they are the final approver and we don't have a next approver @@ -4831,6 +4848,7 @@ function canEditFieldOfMoneyRequest( } // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const reportPolicy = policy ?? getPolicy(moneyRequestReport?.policyID); const isAdmin = isExpenseReport(moneyRequestReport) && reportPolicy?.role === CONST.POLICY.ROLE.ADMIN; const isManager = isExpenseReport(moneyRequestReport) && currentUserAccountID === moneyRequestReport?.managerID; @@ -4955,6 +4973,7 @@ function canEditReportAction(reportAction: OnyxInputOrEntry): bool } function canModifyHoldStatus(report: Report, reportAction: ReportAction): boolean { + // eslint-disable-next-line @typescript-eslint/no-deprecated if (!isMoneyRequestReport(report) || isTrackExpenseReport(report)) { return false; } @@ -4984,6 +5003,7 @@ function canHoldUnholdReportAction( const isApproved = isReportApproved({report}); const isRequestIOU = isIOUReport(report); const isHoldActionCreator = isActionCreator(holdReportAction); + // eslint-disable-next-line @typescript-eslint/no-deprecated const isTrackExpenseMoneyReport = isTrackExpenseReport(report); const isActionOwner = isActionCreator(reportAction); const isApprover = isMoneyRequestReport(report) && report.managerID !== null && currentUserPersonalDetails?.accountID === report?.managerID; @@ -5140,10 +5160,12 @@ function getTransactionReportName({ reports?: Report[]; }): string { if (reportAction && isReversedTransaction(reportAction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('parentReportAction.reversedTransaction'); } if (reportAction && isDeletedAction(reportAction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('parentReportAction.deletedExpense'); } @@ -5151,33 +5173,41 @@ function getTransactionReportName({ if (isEmptyObject(transaction)) { // Transaction data might be empty on app's first load, if so we fallback to Expense/Track Expense + // eslint-disable-next-line @typescript-eslint/no-deprecated return isTrackExpenseAction(reportAction) ? translateLocal('iou.createExpense') : translateLocal('iou.expense'); } if (isScanning(transaction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.receiptScanning', {count: 1}); } const report = getReportOrDraftReport(transaction?.reportID, reports); if (hasMissingSmartscanFieldsTransactionUtils(transaction, report)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.receiptMissingDetails'); } + // eslint-disable-next-line @typescript-eslint/no-deprecated if (isFetchingWaypointsFromServer(transaction) && getMerchant(transaction) === translateLocal('iou.fieldPending')) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.fieldPending'); } // The unit does not matter as we are only interested in whether the distance is zero or not if (isMapDistanceRequest(transaction) && !getDistanceInMeters(transaction, CONST.CUSTOM_UNITS.DISTANCE_UNIT_KILOMETERS) && !hasReceiptTransactionUtils(transaction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('violations.noRoute'); } if (isSentMoneyReportAction(reportAction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return getIOUReportActionDisplayMessage(translateLocal, reportAction as ReportAction, transaction); } const amount = getTransactionAmount(transaction, !isEmptyObject(report) && isExpenseReport(report), transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) ?? 0; const formattedAmount = convertToDisplayString(amount, getCurrency(transaction)) ?? ''; const comment = getMerchantOrDescription(transaction); + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.threadExpenseReportName', formattedAmount, Parser.htmlToText(comment)); } @@ -5230,15 +5260,18 @@ function getReportPreviewMessage( if (!isEmptyObject(linkedTransaction)) { if (isScanning(linkedTransaction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.receiptScanning', {count: 1}); } if (hasMissingSmartscanFieldsTransactionUtils(linkedTransaction, report)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.receiptMissingDetails'); } const amount = getTransactionAmount(linkedTransaction, !isEmptyObject(report) && isExpenseReport(report), linkedTransaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) ?? 0; const formattedAmount = convertToDisplayString(amount, getCurrency(linkedTransaction)) ?? ''; + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.didSplitAmount', formattedAmount, getMerchantOrDescription(linkedTransaction)); } } @@ -5254,6 +5287,7 @@ function getReportPreviewMessage( if (amount && currency) { const formattedAmount = convertToDisplayString(amount, currency); + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.trackedAmount', formattedAmount, comment); } @@ -5262,10 +5296,12 @@ function getReportPreviewMessage( if (!isEmptyObject(linkedTransaction)) { if (isScanning(linkedTransaction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.receiptScanning', {count: 1}); } if (hasMissingSmartscanFieldsTransactionUtils(linkedTransaction, report)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.receiptMissingDetails'); } @@ -5274,6 +5310,7 @@ function getReportPreviewMessage( const merchantOrComment = getMerchantOrDescription(linkedTransaction); + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.trackedAmount', formattedAmount, merchantOrComment); } } @@ -5290,6 +5327,7 @@ function getReportPreviewMessage( const formattedAmount = convertToDisplayString(totalAmount, report.currency); if (isReportApproved({report}) && isPaidGroupPolicy(report)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.managerApprovedAmount', payerName ?? '', formattedAmount); } @@ -5301,10 +5339,12 @@ function getReportPreviewMessage( } if (!isEmptyObject(linkedTransaction) && isScanning(linkedTransaction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.receiptScanning', {count: numberOfScanningReceipts}); } if (!isEmptyObject(linkedTransaction) && isFetchingWaypointsFromServer(linkedTransaction) && !getTransactionAmount(linkedTransaction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.fieldPending'); } @@ -5334,6 +5374,7 @@ function getReportPreviewMessage( if (isFromInvoice) { translatePhraseKey = originalMessage?.payAsBusiness ? 'iou.settleInvoiceBusiness' : 'iou.settleInvoicePersonal'; const currentBankAccount = getBankAccountFromID(originalMessage?.bankAccountID); + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal(translatePhraseKey, formattedAmount, currentBankAccount?.accountData?.accountNumber?.slice(-4) ?? ''); } } @@ -5347,21 +5388,26 @@ function getReportPreviewMessage( actualPayerName = actualPayerName && isForListPreview && !isPreviewMessageForParentChatReport ? `${actualPayerName}:` : actualPayerName; const payerDisplayName = isPreviewMessageForParentChatReport ? payerName : actualPayerName; if (translatePhraseKey === 'iou.businessBankAccount') { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal(translatePhraseKey, '', reportPolicy?.achAccount?.accountNumber?.slice(-4) ?? ''); } if (translatePhraseKey === 'iou.automaticallyPaidWithExpensify' || translatePhraseKey === 'iou.paidWithExpensify') { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal(translatePhraseKey, payerDisplayName ?? ''); } if (translatePhraseKey === 'iou.paidElsewhere') { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal(translatePhraseKey, {payer: payerDisplayName ?? undefined}); } if (translatePhraseKey === 'iou.payerPaidAmount') { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal(translatePhraseKey, formattedAmount, payerDisplayName ?? ''); } } if (report.isWaitingOnBankAccount) { const submitterDisplayName = getDisplayNameForParticipant({accountID: report.ownerAccountID, shouldUseShortForm: true, formatPhoneNumber: formatPhoneNumberPhoneUtils}) ?? ''; + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.waitingOnBankAccount', {submitterDisplayName}); } @@ -5392,16 +5438,19 @@ function getReportPreviewMessage( lastActorID && lastActorID !== currentUserAccountID ? getDisplayNameForParticipant({accountID: lastActorID, shouldUseShortForm: !isPreviewMessageForParentChatReport, formatPhoneNumber: formatPhoneNumberPhoneUtils}) : ''; + // eslint-disable-next-line @typescript-eslint/no-deprecated return `${requestorName ? `${requestorName}: ` : ''}${translateLocal('iou.expenseAmount', amountToDisplay, comment)}`; } if (containsNonReimbursable) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal( 'iou.payerSpentAmount', formattedAmount, getDisplayNameForParticipant({accountID: report.ownerAccountID, formatPhoneNumber: formatPhoneNumberPhoneUtils}) ?? '', ); } + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('iou.payerOwesAmount', formattedAmount, payerName ?? '', comment); } @@ -5488,6 +5537,7 @@ function getModifiedExpenseOriginalMessage( } if ( + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing ('customUnitRateID' in transactionChanges && updatedTransaction?.comment?.customUnit?.customUnitRateID) || ('distance' in transactionChanges && updatedTransaction?.comment?.customUnit?.quantity) ) { @@ -5702,6 +5752,7 @@ function getReportName(reportNameInformation: GetReportNameParams): string { const reportPolicy = policy ?? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]; + // eslint-disable-next-line @typescript-eslint/no-deprecated const parentReportActionBasedName = computeReportNameBasedOnReportAction(translateLocal, parentReportAction, report, reportPolicy, parentReport); if (parentReportActionBasedName) { @@ -5733,24 +5784,29 @@ function getReportName(reportNameInformation: GetReportNameParams): string { } if (!isEmptyObject(parentReportAction) && isOldDotReportAction(parentReportAction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return getMessageOfOldDotReportAction(translateLocal, parentReportAction); } if (isRenamedAction(parentReportAction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return getRenamedAction(translateLocal, parentReportAction, isExpenseReport(getReport(report.parentReportID, allReports))); } if (parentReportActionMessage?.isDeletedParentAction) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('parentReportAction.deletedMessage'); } if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RESOLVED_DUPLICATES) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('violations.resolvedDuplicates'); } const isAttachment = isReportActionAttachment(!isEmptyObject(parentReportAction) ? parentReportAction : undefined); const reportActionMessage = getReportActionMessage({ reportAction: parentReportAction, + // eslint-disable-next-line @typescript-eslint/no-deprecated translate: translateLocal, formatPhoneNumber: formatPhoneNumberPhoneUtils, reportID: report?.parentReportID, @@ -5759,6 +5815,7 @@ function getReportName(reportNameInformation: GetReportNameParams): string { personalDetails, }).replaceAll(/(\n+|\r\n|\n|\r)/gm, ' '); if (isAttachment && reportActionMessage) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return `[${translateLocal('common.attachment')}]`; } if ( @@ -5766,9 +5823,11 @@ function getReportName(reportNameInformation: GetReportNameParams): string { parentReportActionMessage?.moderationDecision?.decision === CONST.MODERATION.MODERATOR_DECISION_HIDDEN || parentReportActionMessage?.moderationDecision?.decision === CONST.MODERATION.MODERATOR_DECISION_PENDING_REMOVE ) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('parentReportAction.hiddenMessage'); } if (isAdminRoom(report) || isUserCreatedPolicyRoom(report)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return getAdminRoomInvitedParticipants(translateLocal, parentReportAction, reportActionMessage); } @@ -5792,12 +5851,14 @@ function getReportName(reportNameInformation: GetReportNameParams): string { return report?.reportName ?? ''; } if (isCardIssuedAction(parentReportAction)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return getCardIssuedMessage({reportAction: parentReportAction, translate: translateLocal}); } return reportActionMessage; } if (isClosedExpenseReportWithNoExpenses(report, transactions)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('parentReportAction.deletedReport'); } @@ -5826,6 +5887,7 @@ function getReportName(reportNameInformation: GetReportNameParams): string { formattedName = getInvoicesChatName({ report, // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated receiverPolicy: invoiceReceiverPolicy ?? getPolicy(invoiceReceiverPolicyID), personalDetails, policies, @@ -5881,6 +5943,7 @@ function getSearchReportName(props: GetReportNameParams): string { visitedReportIDs.add(currentParent.reportID); if (isExpenseReport(currentParent)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return getReportName({ report: currentParent, policy, @@ -5901,6 +5964,7 @@ function getSearchReportName(props: GetReportNameParams): string { return policy.name; } // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 + // eslint-disable-next-line @typescript-eslint/no-deprecated return getReportName({ report, policy, @@ -5967,12 +6031,15 @@ function getChatRoomSubtitle(report: OnyxEntry, isPolicyNamePreferred = return ''; } if (isSelfDM(report)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('reportActionsView.yourSpace'); } if (isInvoiceRoom(report)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('workspace.common.invoices'); } if (isConciergeChatReport(report)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('reportActionsView.conciergeSupport'); } if (!isDefaultRoom(report) && !isUserCreatedPolicyRoom(report) && !isPolicyExpenseChat(report)) { @@ -5991,6 +6058,7 @@ function getChatRoomSubtitle(report: OnyxEntry, isPolicyNamePreferred = if (!subtitle || !isPolicyNamePreferred) { return getPolicyName({report}); } + // eslint-disable-next-line @typescript-eslint/no-deprecated return `${getReportSubtitlePrefix(report)}${translateLocal('iou.submitsTo', subtitle ?? '')}`; } @@ -6018,10 +6086,12 @@ function getParentNavigationSubtitle(report: OnyxEntry, isParentReportAr const ownerAccountID = report?.ownerAccountID; const personalDetails = ownerAccountID ? allPersonalDetails?.[ownerAccountID] : undefined; const login = personalDetails ? personalDetails.login : null; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const reportOwnerDisplayName = getDisplayNameForParticipant({accountID: ownerAccountID, shouldRemoveDomain: true, formatPhoneNumber: formatPhoneNumberPhoneUtils}) || login; if (isExpenseReport(report)) { return { + // eslint-disable-next-line @typescript-eslint/no-deprecated reportName: translateLocal('workspace.common.policyExpenseChatName', reportOwnerDisplayName ?? ''), workspaceName: getPolicyName({report}), }; @@ -6036,6 +6106,7 @@ function getParentNavigationSubtitle(report: OnyxEntry, isParentReportAr let reportName = `${getPolicyName({report: parentReport})} & ${getInvoicePayerName(parentReport)}`; if (isArchivedNonExpenseReport(parentReport, isParentReportArchived)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated reportName += ` (${translateLocal('common.archived')})`; } @@ -6046,6 +6117,7 @@ function getParentNavigationSubtitle(report: OnyxEntry, isParentReportAr return { // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 + // eslint-disable-next-line @typescript-eslint/no-deprecated reportName: getReportName({report: parentReport, reportAttributes}), workspaceName: getPolicyName({report: parentReport, returnEmptyIfNotFound: true}), }; @@ -6173,6 +6245,7 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails, mediaAt if (parsingDetails?.policyID) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policyType = getPolicy(parsingDetails?.policyID)?.type; if (policyType) { isGroupPolicyReport = isGroupPolicy(policyType); @@ -6377,6 +6450,7 @@ function buildOptimisticTaskCommentReportAction( // These parameters are not saved on the reportAction, but are used to display the task in the UI // Added when we fetch the reportActions on a report + // eslint-disable-next-line reportAction.reportAction.originalMessage = { html: getReportActionHtml(reportAction.reportAction), taskReportID: getReportActionMessageReportUtils(reportAction.reportAction)?.taskReportID, @@ -6451,6 +6525,7 @@ function buildOptimisticIOUReport( const payerEmail = 'login' in personalDetails ? personalDetails.login : ''; const policyID = chatReportID ? getReport(chatReportID, allReports)?.policyID : undefined; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const created = createdTimestamp ?? DateUtils.getDBTime(); @@ -6587,6 +6662,7 @@ function computeOptimisticReportName(report: Report, policy: OnyxEntry, }; // We use dynamic require here to avoid a circular dependency between ReportUtils and Formula + // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires const Formula = require('./Formula') as {compute: (formula?: string, context?: FormulaContext) => string}; // If there is no title field, use "New Report" as default (matches OldDot behavior) @@ -6662,6 +6738,7 @@ function buildOptimisticExpenseReport({ const policyName = getPolicyName({report}); const formattedTotal = convertToDisplayString(storedTotal, currency); // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policyReal = getPolicy(policyID); const policyDraft = allPolicyDrafts?.[`${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${policyID}`]; const policy = policyReal ?? policyDraft; @@ -6787,6 +6864,7 @@ function getMovedTransactionMessage(translate: LocalizedTranslate, action: Repor const report = fromReport ?? toReport; // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 + // eslint-disable-next-line @typescript-eslint/no-deprecated const reportName = Parser.htmlToText(getReportName({report}) ?? report?.reportName ?? ''); const reportUrl = getReportURLForCurrentContext(report?.reportID); if (typeof fromReportID === 'undefined') { @@ -6802,6 +6880,7 @@ function getUnreportedTransactionMessage(translate: LocalizedTranslate, action: const fromReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${fromReportID}`]; // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 + // eslint-disable-next-line @typescript-eslint/no-deprecated const reportName = Parser.htmlToText(getReportName({report: fromReport}) ?? fromReport?.reportName ?? ''); let reportUrl = getReportURLForCurrentContext(fromReportID); @@ -7220,8 +7299,10 @@ function buildOptimisticChangePolicyReportAction(fromPolicyID: string | undefine }; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const fromPolicy = getPolicy(fromPolicyID); // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const toPolicy = getPolicy(toPolicyID); const changePolicyReportActionMessage = [ @@ -8285,6 +8366,7 @@ function buildOptimisticChangeApproverReportAction(managerID: number, actorAccou function buildOptimisticAnnounceChat(policyID: string, accountIDs: number[]): OptimisticAnnounceChat { const announceReport = getRoom(CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE, policyID); // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const announceRoomOnyxData: AnnounceRoomOnyxData = { onyxOptimisticData: [], @@ -9227,6 +9309,7 @@ function hasReportErrorsOtherThanFailedReceipt( return ( doesTransactionThreadReportHasViolations || doesReportHaveViolations || + // eslint-disable-next-line @typescript-eslint/no-deprecated Object.values(allReportErrors).some((error) => error?.[0] !== translateLocal('iou.error.genericSmartscanFailureMessage')) || !!getReceiptUploadErrorReason(report, chatReport, transactionReportActions, transactions) ); @@ -9335,6 +9418,7 @@ function reasonForReportToBeInOptionList({ } // Include reports that are relevant to the user in any view mode. Criteria include having a draft or having a GBR showing. + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (draftComment) { return CONST.REPORT_IN_LHN_REASONS.HAS_DRAFT_COMMENT; } @@ -9754,6 +9838,7 @@ function getMoneyRequestOptions( // We don't allow IOU actions if an Expensify account is a participant of the report, unless the policy that the report is on is owned by an Expensify account const doParticipantsIncludeExpensifyAccounts = lodashIntersection(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS).length > 0; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policyOwnerAccountID = getPolicy(report?.policyID)?.ownerAccountID; const isPolicyOwnedByExpensifyAccounts = policyOwnerAccountID ? CONST.EXPENSIFY_ACCOUNT_IDS.includes(policyOwnerAccountID) : false; if (doParticipantsIncludeExpensifyAccounts && !isPolicyOwnedByExpensifyAccounts) { @@ -9868,6 +9953,7 @@ function canLeaveInvoiceRoom(report: OnyxEntry): boolean { return false; } // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const isSenderPolicyAdmin = getPolicy(report.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isSenderPolicyAdmin) { @@ -9879,6 +9965,7 @@ function canLeaveInvoiceRoom(report: OnyxEntry): boolean { } // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const isReceiverPolicyAdmin = getPolicy(report.invoiceReceiver.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isReceiverPolicyAdmin) { @@ -10852,6 +10939,7 @@ function isReportOwner(report: OnyxInputOrEntry): boolean { function isAllowedToApproveExpenseReport(report: OnyxEntry, approverAccountID?: number, reportPolicy?: OnyxEntry): boolean { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = reportPolicy ?? getPolicy(report?.policyID); const isOwner = (approverAccountID ?? currentUserAccountID) === report?.ownerAccountID; return !(policy?.preventSelfApproval && isOwner); @@ -10859,6 +10947,7 @@ function isAllowedToApproveExpenseReport(report: OnyxEntry, approverAcco function isAllowedToSubmitDraftExpenseReport(report: OnyxEntry): boolean { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(report?.policyID); const submitToAccountID = getSubmitToAccountID(policy, report); @@ -11319,6 +11408,7 @@ function getOutstandingChildRequest(iouReport: OnyxInputOrEntry): Outsta } // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(iouReport.policyID); const shouldBeManuallySubmitted = isPaidGroupPolicyPolicyUtils(policy) && !policy?.harvesting?.enabled && isOpenReport(iouReport); if (shouldBeManuallySubmitted) { @@ -11417,6 +11507,7 @@ function prepareOnboardingOnyxData({ const integrationName = userReportedIntegration ? CONST.ONBOARDING_ACCOUNTING_MAPPING[userReportedIntegration as keyof typeof CONST.ONBOARDING_ACCOUNTING_MAPPING] : ''; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const assignedGuideEmail = getPolicy(targetChatPolicyID)?.assignedGuide?.email ?? CONST.SETUP_SPECIALIST_LOGIN; const assignedGuidePersonalDetail = getPersonalDetailByEmail(assignedGuideEmail); let assignedGuideAccountID: number; @@ -11594,6 +11685,7 @@ function prepareOnboardingOnyxData({ // Sign-off welcome message const welcomeSignOffText = + // eslint-disable-next-line @typescript-eslint/no-deprecated engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM ? translateLocal('onboarding.welcomeSignOffTitleManageTeam') : translateLocal('onboarding.welcomeSignOffTitle'); const welcomeSignOffComment = buildOptimisticAddCommentReportAction(welcomeSignOffText, undefined, actorAccountID, tasksData.length + 3); const welcomeSignOffCommentAction: OptimisticAddCommentReportAction = welcomeSignOffComment.reportAction; @@ -11957,6 +12049,7 @@ function prepareOnboardingOnyxData({ key: `${ONYXKEYS.COLLECTION.POLICY}${onboardingPolicyID}`, value: { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated areConnectionsEnabled: getPolicy(onboardingPolicyID)?.areConnectionsEnabled, pendingFields: { areConnectionsEnabled: null, @@ -12167,6 +12260,7 @@ function getFieldViolationTranslation(reportField: PolicyReportField, violation? switch (violation) { case 'fieldRequired': + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('reportViolations.fieldRequired', reportField.name); default: return ''; @@ -12353,6 +12447,7 @@ function doesReportContainRequestsFromMultipleUsers(iouReport: OnyxEntry const transactions = getReportTransactions(iouReport?.reportID).filter( (transaction) => !shouldExcludeDeletedTransactions || transaction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, ); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing return isIOUReport(iouReport) && transactions.some((transaction) => (Number(transaction?.modifiedAmount) || transaction?.amount) <= 0); } @@ -12467,6 +12562,7 @@ function hasMissingInvoiceBankAccount(iouReportID: string | undefined): boolean } // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated return invoiceReport?.ownerAccountID === currentUserAccountID && !getPolicy(invoiceReport?.policyID)?.invoice?.bankAccount?.transferBankAccountID && isSettled(iouReportID); } @@ -12513,10 +12609,12 @@ function getChatListItemReportName(action: ReportAction & {reportName?: string}, if (report?.reportID) { // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 + // eslint-disable-next-line @typescript-eslint/no-deprecated return getReportName({report: getReport(report?.reportID, allReports)}); } // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 + // eslint-disable-next-line @typescript-eslint/no-deprecated return getReportName({report}); } @@ -13042,6 +13140,7 @@ export { getReportFieldMaps, getReportIDFromLink, // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 + // eslint-disable-next-line @typescript-eslint/no-deprecated getSearchReportName, getReportTransactions, reportTransactionsSelector, @@ -13172,6 +13271,7 @@ export { isSystemChat, isTaskReport, isThread, + // eslint-disable-next-line @typescript-eslint/no-deprecated isTrackExpenseReport, isUnread, isUnreadWithMention, @@ -13298,6 +13398,7 @@ export { getReceiptUploadErrorReason, getAncestors, // This will be fixed as follow up https://github.com/Expensify/App/pull/75357 + // eslint-disable-next-line @typescript-eslint/no-deprecated getReportName, doesReportContainRequestsFromMultipleUsers, hasUnresolvedCardFraudAlert, diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 18b0f424ef6bf..73dd6df35835e 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -1289,6 +1289,7 @@ function isAmountTooLong(amount: number, maxLength = 8): boolean { } function isTransactionAmountTooLong(transactionItem: TransactionListItemType | OnyxTypes.Transaction) { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const amount = Math.abs(Number(transactionItem.modifiedAmount) || transactionItem.amount); return isAmountTooLong(amount); } @@ -1641,6 +1642,7 @@ function getToFieldValueForTransaction( report?.managerID ?? CONST.DEFAULT_NUMBER_ID, report?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID, personalDetailsList, + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing Number(transactionItem.modifiedAmount) || transactionItem.amount, )?.to ?? emptyPersonalDetails ); @@ -1876,6 +1878,7 @@ function getActions( } // We need to check both options for a falsy value since the transaction might not have an error but the report associated with it might. We return early if there are any errors for performance reasons, so we don't need to compute any other possible actions. + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (transaction?.errors || report?.errors) { return [CONST.SEARCH.ACTION_TYPES.VIEW]; } @@ -3405,6 +3408,7 @@ function getCustomColumnDefault(value?: SearchDataTypes | SearchGroupBy): Search } function getSearchColumnTranslationKey(columnId: SearchCustomColumnIds): TranslationPaths { + // eslint-disable-next-line default-case switch (columnId) { case CONST.SEARCH.TABLE_COLUMNS.DATE: return 'common.date'; @@ -4420,6 +4424,7 @@ function getSettlementStatusBadgeProps( */ function getTransactionFromTransactionListItem(item: TransactionListItemType): OnyxTypes.Transaction { // Extract only the core Transaction fields, excluding UI-specific and search-specific fields + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { keyForList, action, diff --git a/src/libs/TransactionUtils/index.ts b/src/libs/TransactionUtils/index.ts index 43826e949a70c..abea2098689de 100644 --- a/src/libs/TransactionUtils/index.ts +++ b/src/libs/TransactionUtils/index.ts @@ -2411,6 +2411,7 @@ function compareDuplicateTransactionFields( .map((item) => { // Prioritize modifiedMerchant over merchant if (keys.includes('modifiedMerchant' as keyof Transaction) && keys.includes('merchant' as keyof Transaction)) { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing return getMerchant(item); } return keys.map((key) => item?.[key]); @@ -2615,6 +2616,7 @@ function isExpenseSplit(transaction: OnyxEntry, originalTransaction const {originalTransactionID, source, splits} = transaction?.comment ?? {}; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if ((splits && splits.length > 0) || !originalTransactionID || source !== CONST.IOU.TYPE.SPLIT) { return false; } diff --git a/src/libs/Violations/ViolationsUtils.ts b/src/libs/Violations/ViolationsUtils.ts index f394b5c4e4a9f..c47b0cbde5817 100644 --- a/src/libs/Violations/ViolationsUtils.ts +++ b/src/libs/Violations/ViolationsUtils.ts @@ -429,6 +429,7 @@ const ViolationsUtils = { const isPolicyTrackTaxEnabled = isTaxTrackingEnabled(true, policy, isDistanceRequest, isPerDiemRequest, isTimeRequest); const isTaxInPolicy = Object.keys(policy.taxRates?.taxes ?? {}).some((key) => key === updatedTransaction.taxCode); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const amount = hasValidModifiedAmount(updatedTransaction) ? Number(updatedTransaction.modifiedAmount) : updatedTransaction.amount; // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const currency = updatedTransaction.modifiedCurrency || updatedTransaction.currency; diff --git a/src/libs/actions/App.ts b/src/libs/actions/App.ts index 3b998d496a97c..17c97850e33f5 100644 --- a/src/libs/actions/App.ts +++ b/src/libs/actions/App.ts @@ -161,6 +161,7 @@ Onyx.connectWithoutView({ // Set this to false to reset the flag for this client Onyx.set(ONYXKEYS.RESET_REQUIRED, false); + // eslint-disable-next-line @typescript-eslint/no-use-before-define openApp(); }); }, diff --git a/src/libs/actions/CanvasSize.ts b/src/libs/actions/CanvasSize.ts index d91a2bfdcd3a4..050a877eceb8a 100644 --- a/src/libs/actions/CanvasSize.ts +++ b/src/libs/actions/CanvasSize.ts @@ -42,4 +42,9 @@ function retrieveMaxCanvasWidth() { }); } -export {retrieveMaxCanvasArea, retrieveMaxCanvasHeight, retrieveMaxCanvasWidth}; +export { + // eslint-disable-next-line import/prefer-default-export + retrieveMaxCanvasArea, + retrieveMaxCanvasHeight, + retrieveMaxCanvasWidth, +}; diff --git a/src/libs/actions/CloseAccount.ts b/src/libs/actions/CloseAccount.ts index c871abb2bd1e6..01b115a23518c 100644 --- a/src/libs/actions/CloseAccount.ts +++ b/src/libs/actions/CloseAccount.ts @@ -16,4 +16,8 @@ function setDefaultData() { Onyx.merge(ONYXKEYS.FORMS.CLOSE_ACCOUNT_FORM, {...CONST.DEFAULT_CLOSE_ACCOUNT_DATA}); } -export {clearError, setDefaultData}; +export { + // eslint-disable-next-line import/prefer-default-export + clearError, + setDefaultData, +}; diff --git a/src/libs/actions/ExitSurvey.ts b/src/libs/actions/ExitSurvey.ts index fee304672d1a9..dfcb0f3ed7fa0 100644 --- a/src/libs/actions/ExitSurvey.ts +++ b/src/libs/actions/ExitSurvey.ts @@ -26,6 +26,7 @@ function switchToOldDot(exitSurveyResponse: string | undefined) { }, ]; + // eslint-disable-next-line rulesdir/no-api-side-effects-method API.write( WRITE_COMMANDS.SWITCH_TO_OLD_DOT, { diff --git a/src/libs/actions/IOU/index.ts b/src/libs/actions/IOU/index.ts index 95391bf0e6228..5040a9c6a443e 100644 --- a/src/libs/actions/IOU/index.ts +++ b/src/libs/actions/IOU/index.ts @@ -1236,6 +1236,7 @@ function initMoneyRequest({ const currency = policy?.outputCurrency ?? personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD; // Disabling this line since currentDate can be an empty string + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const created = currentDate || format(new Date(), 'yyyy-MM-dd'); // We remove draft transactions created during multi scanning if there are some @@ -1903,6 +1904,7 @@ function buildOnyxDataForTestDriveIOU( transactionID: testDriveIOUParams.transaction.transactionID, reportActionID: testDriveIOUParams.iouOptimisticParams.action.reportActionID, }); + // eslint-disable-next-line @typescript-eslint/no-deprecated const text = Localize.translateLocal('testDrive.employeeInviteMessage', personalDetailsList?.[userAccountID]?.firstName ?? ''); const textComment = buildOptimisticAddCommentReportAction(text, undefined, userAccountID, undefined, undefined, testDriveIOUParams.testDriveCommentReportActionID); textComment.reportAction.created = DateUtils.subtractMillisecondsFromDateTime(testDriveIOUParams.iouOptimisticParams.createdAction.created, 1); @@ -2592,6 +2594,7 @@ function buildOnyxDataForMoneyRequest(moneyRequestParams: BuildOnyxDataForMoneyR key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${iou.report.reportID}`, onyxMethod: Onyx.METHOD.SET, // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated value: buildNextStepNew({ report: iou.report, predictedNextStatus: iou.report.statusNum ?? CONST.REPORT.STATE_NUM.OPEN, @@ -3551,6 +3554,7 @@ function getMoneyRequestInformation(moneyRequestInformation: MoneyRequestInforma const optimisticPolicyRecentlyUsedCategories = mergePolicyRecentlyUsedCategories(category, policyRecentlyUsedCategories); const optimisticPolicyRecentlyUsedTags = buildOptimisticPolicyRecentlyUsedTags({ // TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) and getPolicyRecentlyUsedTagsData (https://github.com/Expensify/App/issues/71491) with useOnyx hook + // eslint-disable-next-line @typescript-eslint/no-deprecated policyTags: getPolicyTagsData(iouReport.policyID), policyRecentlyUsedTags, transactionTags: tag, @@ -3582,7 +3586,9 @@ function getMoneyRequestInformation(moneyRequestInformation: MoneyRequestInforma optimisticTransaction = fastMerge(existingTransactionWithoutConvertedAmount, optimisticTransaction, false); // Calculate proportional convertedAmount for the split based on the original conversion rate + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- modifiedAmount can be empty string const originalAmount = Number(existingTransaction.modifiedAmount) || existingTransaction.amount; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- modifiedAmount can be empty string const splitAmount = Number(optimisticTransaction.modifiedAmount) || optimisticTransaction.amount; if (originalConvertedAmount && originalAmount && splitAmount) { optimisticTransaction.convertedAmount = Math.round((originalConvertedAmount * splitAmount) / originalAmount); @@ -3646,6 +3652,7 @@ function getMoneyRequestInformation(moneyRequestInformation: MoneyRequestInforma iouReport.statusNum ?? (policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.OPEN); const hasViolations = hasViolationsReportUtils(iouReport.reportID, transactionViolations, currentUserAccountIDParam, currentUserEmailParam); // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: iouReport, predictedNextStatus, @@ -3923,6 +3930,7 @@ function getPerDiemExpenseInformation(perDiemExpenseInformation: PerDiemExpenseI const optimisticPolicyRecentlyUsedCategories = mergePolicyRecentlyUsedCategories(category, policyRecentlyUsedCategories); const optimisticPolicyRecentlyUsedTags = buildOptimisticPolicyRecentlyUsedTags({ // TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) and getPolicyRecentlyUsedTagsData (https://github.com/Expensify/App/issues/71491) with useOnyx hook + // eslint-disable-next-line @typescript-eslint/no-deprecated policyTags: getPolicyTagsData(iouReport.policyID), policyRecentlyUsedTags, transactionTags: tag, @@ -3980,6 +3988,7 @@ function getPerDiemExpenseInformation(perDiemExpenseInformation: PerDiemExpenseI const predictedNextStatus = iouReport.statusNum ?? (policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.OPEN); // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: iouReport, predictedNextStatus, @@ -4810,6 +4819,7 @@ function getUpdateMoneyRequestParams(params: GetUpdateMoneyRequestParamsType): U if (hasModifiedTag) { const optimisticPolicyRecentlyUsedTags = buildOptimisticPolicyRecentlyUsedTags({ // TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) and getPolicyRecentlyUsedTagsData (https://github.com/Expensify/App/issues/71491) with useOnyx hook + // eslint-disable-next-line @typescript-eslint/no-deprecated policyTags: getPolicyTagsData(iouReport?.policyID), policyRecentlyUsedTags, transactionTags: transactionChanges.tag, @@ -4990,6 +5000,7 @@ function getUpdateMoneyRequestParams(params: GetUpdateMoneyRequestParamsType): U onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${iouReport?.reportID}`, // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated value: buildNextStepNew({ report: moneyRequestReport, predictedNextStatus: iouReport?.statusNum ?? CONST.REPORT.STATUS_NUM.OPEN, @@ -5272,6 +5283,7 @@ function updateMoneyRequestDate({ created: value, }; let data: UpdateMoneyRequestData; + // eslint-disable-next-line @typescript-eslint/no-deprecated if (isTrackExpenseReport(transactionThreadReport) && isSelfDM(parentReport)) { data = getUpdateTrackExpenseParams(transactionID, transactionThreadReport?.reportID, transactionChanges, policy); } else { @@ -5419,6 +5431,7 @@ function updateMoneyRequestMerchant({ merchant: value, }; let data: UpdateMoneyRequestData; + // eslint-disable-next-line @typescript-eslint/no-deprecated if (isTrackExpenseReport(transactionThreadReport) && isSelfDM(parentReport)) { data = getUpdateTrackExpenseParams(transactionID, transactionThreadReport?.reportID, transactionChanges, policy); } else { @@ -5689,6 +5702,7 @@ function updateMoneyRequestDistance({ ...(odometerEnd !== undefined && {odometerEnd}), }; let data: UpdateMoneyRequestData; + // eslint-disable-next-line @typescript-eslint/no-deprecated if (isTrackExpenseReport(transactionThreadReport) && isSelfDM(parentReport)) { data = getUpdateTrackExpenseParams(transactionID, transactionThreadReport?.reportID, transactionChanges, policy); } else { @@ -5843,6 +5857,7 @@ function updateMoneyRequestDescription({ comment: parsedComment, }; let data: UpdateMoneyRequestData; + // eslint-disable-next-line @typescript-eslint/no-deprecated if (isTrackExpenseReport(transactionThreadReport) && isSelfDM(parentReport)) { data = getUpdateTrackExpenseParams(transactionID, transactionThreadReport?.reportID, transactionChanges, policy); } else { @@ -5913,6 +5928,7 @@ function updateMoneyRequestDistanceRate({ } let data: UpdateMoneyRequestData; + // eslint-disable-next-line @typescript-eslint/no-deprecated if (isTrackExpenseReport(transactionThreadReport) && isSelfDM(parentReport)) { data = getUpdateTrackExpenseParams(transactionID, transactionThreadReport?.reportID, transactionChanges, policy); } else { @@ -6813,11 +6829,13 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation): {iouRep } : {}), }; + // eslint-disable-next-line rulesdir/no-multiple-api-calls API.write(WRITE_COMMANDS.REQUEST_MONEY, parameters, onyxData); } } if (shouldHandleNavigation) { + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => removeDraftTransactionsByIDs(draftTransactionIDs)); const trackReport = Navigation.getReportRouteByID(linkedTrackedExpenseReportAction?.childReportID); @@ -6954,6 +6972,7 @@ function submitPerDiemExpense(submitPerDiemExpenseInformation: PerDiemExpenseInf playSound(SOUNDS.DONE); API.write(WRITE_COMMANDS.CREATE_PER_DIEM_REQUEST, parameters, onyxData); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => removeDraftTransaction(CONST.IOU.OPTIMISTIC_TRANSACTION_ID)); handleNavigateAfterExpenseCreate({activeReportID, transactionID: transaction.transactionID, isFromGlobalCreate, shouldHandleNavigation}); @@ -7353,6 +7372,7 @@ function submitPerDiemExpenseForSelfDM(submitPerDiemExpenseInformation: PerDiemE playSound(SOUNDS.DONE); API.write(WRITE_COMMANDS.CREATE_PER_DIEM_REQUEST, parameters, onyxData); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => removeDraftTransaction(CONST.IOU.OPTIMISTIC_TRANSACTION_ID)); dismissModalAndOpenReportInInboxTab(chatReport.reportID); @@ -7705,6 +7725,7 @@ function trackExpense(params: CreateTrackExpenseParams) { } if (shouldHandleNavigation) { + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => removeDraftTransactions()); } @@ -7820,6 +7841,7 @@ function createSplitsAndOnyxData({ reportID: CONST.REPORT.SPLIT_REPORT_ID, comment, created, + // eslint-disable-next-line @typescript-eslint/no-deprecated merchant: merchant || Localize.translateLocal('iou.expense'), receipt, category, @@ -8124,6 +8146,7 @@ function createSplitsAndOnyxData({ reportID: oneOnOneIOUReport.reportID, comment, created, + // eslint-disable-next-line @typescript-eslint/no-deprecated merchant: merchant || Localize.translateLocal('iou.expense'), category, tag, @@ -8190,6 +8213,7 @@ function createSplitsAndOnyxData({ const optimisticPolicyRecentlyUsedTags = isPolicyExpenseChat ? buildOptimisticPolicyRecentlyUsedTags({ // TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) and getPolicyRecentlyUsedTagsData (https://github.com/Expensify/App/issues/71491) with useOnyx hook + // eslint-disable-next-line @typescript-eslint/no-deprecated policyTags: getPolicyTagsData(participant.policyID), policyRecentlyUsedTags, transactionTags: tag, @@ -8541,6 +8565,7 @@ function createDistanceRequest(distanceRequestInformation: CreateDistanceRequest playSound(SOUNDS.DONE); API.write(WRITE_COMMANDS.CREATE_DISTANCE_REQUEST, parameters, onyxData); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => removeDraftTransaction(CONST.IOU.OPTIMISTIC_TRANSACTION_ID)); const activeReportID = isMoneyRequestReport && report?.reportID ? report.reportID : parameters.chatReportID; @@ -8606,6 +8631,7 @@ function updateMoneyRequestAmountAndCurrency({ }; let data: UpdateMoneyRequestData; + // eslint-disable-next-line @typescript-eslint/no-deprecated if (isTrackExpenseReport(transactionThreadReport) && isSelfDM(parentReport)) { data = getUpdateTrackExpenseParams(transactionID, transactionThreadReport?.reportID, transactionChanges, policy); } else { @@ -8776,6 +8802,7 @@ function prepareToCleanUpMoneyRequest( } const hasNonReimbursableTransactions = hasNonReimbursableTransactionsReportUtils(iouReport?.reportID); + // eslint-disable-next-line @typescript-eslint/no-deprecated const messageText = Localize.translateLocal( hasNonReimbursableTransactions ? 'iou.payerSpentAmount' : 'iou.payerOwesAmount', convertToDisplayString(updatedIOUReport?.total, updatedIOUReport?.currency), @@ -9062,6 +9089,7 @@ function cleanUpMoneyRequest( // First, update the reportActions to ensure related actions are not displayed. Onyx.update(reportActionsOnyxUpdates).then(() => { Navigation.goBack(urlToNavigateBack); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { if (shouldDeleteIOUReport) { clearAllRelatedReportActionErrors(reportID, reportAction, originalReportID); @@ -10133,6 +10161,7 @@ function getPayMoneyRequestParams({ if (!isInvoiceReport) { currentNextStepDeprecated = iouReportCurrentNextStepDeprecated ?? null; // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated optimisticNextStepDeprecated = buildNextStepNew({report: iouReport, predictedNextStatus: CONST.REPORT.STATUS_NUM.REIMBURSED}); optimisticNextStep = buildOptimisticNextStep({report: iouReport, predictedNextStatus: CONST.REPORT.STATUS_NUM.REIMBURSED}); } @@ -10530,6 +10559,7 @@ function getIOUReportActionToApproveOrPay( } const iouReport = updatedIouReport?.reportID === action.childReportID ? updatedIouReport : getReportOrDraftReport(action.childReportID); // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(iouReport?.policyID); // Only show to the actual payer, exclude admins with bank account access const shouldShowSettlementButton = @@ -10935,6 +10965,7 @@ function reopenReport( const predictedNextStatus = CONST.REPORT.STATUS_NUM.OPEN; // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: expenseReport, predictedNextStatus: CONST.REPORT.STATUS_NUM.OPEN, @@ -11117,6 +11148,7 @@ function retractReport( const predictedNextStatus = CONST.REPORT.STATUS_NUM.OPEN; // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: expenseReport, predictedNextStatus: CONST.REPORT.STATUS_NUM.OPEN, @@ -11287,6 +11319,7 @@ function unapproveExpenseReport( const optimisticUnapprovedReportAction = buildOptimisticUnapprovedReportAction(expenseReport.total ?? 0, expenseReport.currency ?? '', expenseReport.reportID); // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: expenseReport, predictedNextStatus: CONST.REPORT.STATUS_NUM.SUBMITTED, @@ -11469,7 +11502,8 @@ function submitReport( // buildOptimisticNextStep is used in parallel const optimisticNextStepDeprecated = isDEWPolicy ? null - : buildNextStepNew({ + : // eslint-disable-next-line @typescript-eslint/no-deprecated + buildNextStepNew({ report: expenseReport, predictedNextStatus: isSubmitAndClosePolicy ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.SUBMITTED, policy, @@ -11729,6 +11763,7 @@ function cancelPayment( const statusNum: ValueOf = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.APPROVED; // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: expenseReport, predictedNextStatus: statusNum, @@ -11891,6 +11926,7 @@ function cancelPayment( onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated value: buildNextStepNew({ report: expenseReport, predictedNextStatus: CONST.REPORT.STATUS_NUM.REIMBURSED, @@ -12147,6 +12183,7 @@ function detachReceipt(transactionID: string | undefined, transactionPolicy: Ony if (transactionPolicy && isPaidGroupPolicy(transactionPolicy) && newTransaction) { // TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) and getPolicyRecentlyUsedTagsData (https://github.com/Expensify/App/issues/71491) with useOnyx hook + // eslint-disable-next-line @typescript-eslint/no-deprecated const policyTagList = getPolicyTagsData(transactionPolicy.id); const currentTransactionViolations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? []; const violationsOnyxData = ViolationsUtils.getViolationsOnyxData( @@ -12273,6 +12310,7 @@ function replaceReceipt({transactionID, file, source, state, transactionPolicy, if (transactionPolicy && isPaidGroupPolicy(transactionPolicy) && newTransaction) { // TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) and getPolicyRecentlyUsedTagsData (https://github.com/Expensify/App/issues/71491) with useOnyx hook + // eslint-disable-next-line @typescript-eslint/no-deprecated const policyTagList = getPolicyTagsData(transactionPolicy.id); const currentTransactionViolations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? []; const violationsOnyxData = ViolationsUtils.getViolationsOnyxData( @@ -13574,6 +13612,7 @@ function assignReportToMe( const takeControlReportAction = buildOptimisticChangeApproverReportAction(accountID, accountID); // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: {...report, managerID: accountID}, predictedNextStatus: report.statusNum ?? CONST.REPORT.STATUS_NUM.SUBMITTED, @@ -13689,6 +13728,7 @@ function addReportApprover( const takeControlReportAction = buildOptimisticChangeApproverReportAction(newApproverAccountID, accountID); // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: {...report, managerID: newApproverAccountID}, predictedNextStatus: report.statusNum ?? CONST.REPORT.STATUS_NUM.SUBMITTED, diff --git a/src/libs/actions/Link.ts b/src/libs/actions/Link.ts index 0101c0da873c9..4777c7a949c51 100644 --- a/src/libs/actions/Link.ts +++ b/src/libs/actions/Link.ts @@ -354,6 +354,7 @@ function openReportFromDeepLink(url: string, reports: OnyxCollection, is key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, // eslint-disable-next-line rulesdir/prefer-early-return callback: (report) => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (report?.errorFields?.notFound || report?.reportID || (report === undefined && CONST.REGEX.NON_NUMERIC.test(reportID))) { Onyx.disconnect(reportConnection); navigateHandler(report); diff --git a/src/libs/actions/MergeTransaction.ts b/src/libs/actions/MergeTransaction.ts index 71611dcb1c19a..dbd8a345aa68b 100644 --- a/src/libs/actions/MergeTransaction.ts +++ b/src/libs/actions/MergeTransaction.ts @@ -524,6 +524,7 @@ function mergeTransactionRequest({ }, ); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const optimisticData: Array> = [ ...(onyxTargetTransactionData.optimisticData ?? []), optimisticMergeTransactionData, @@ -531,6 +532,7 @@ function mergeTransactionRequest({ ...sourceTransactionOptimisticData, ]; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const failureData: Array> = [...(onyxTargetTransactionData.failureData ?? []), ...failureTransactionViolations, ...sourceTransactionFailureData]; const successData: Array> = []; diff --git a/src/libs/actions/MultifactorAuthentication/index.ts b/src/libs/actions/MultifactorAuthentication/index.ts index 3ed2f37d57118..c19edb94394c5 100644 --- a/src/libs/actions/MultifactorAuthentication/index.ts +++ b/src/libs/actions/MultifactorAuthentication/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable rulesdir/no-api-side-effects-method */ // These functions use makeRequestWithSideEffects because challenge data must be returned immediately // for security and timing requirements (see detailed explanation below) import Onyx from 'react-native-onyx'; diff --git a/src/libs/actions/OnyxUpdateManager/types.ts b/src/libs/actions/OnyxUpdateManager/types.ts index 02b4c255bba88..17983f7234072 100644 --- a/src/libs/actions/OnyxUpdateManager/types.ts +++ b/src/libs/actions/OnyxUpdateManager/types.ts @@ -7,6 +7,7 @@ import type {AnyOnyxUpdatesFromServer, OnyxUpdatesFromServer} from '@src/types/o * This type was created as a solution during the migration away from the large OnyxKey union and is useful for contexts where the specific Onyx keys are not known ahead of time. * It should only be used in legacy code where providing exact key types would require major restructuring. */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any type AnyDeferredUpdatesDictionary = Record; /** Maps last update IDs to their corresponding Onyx server updates, allowing multiple updates to be enqueued simultaneously */ diff --git a/src/libs/actions/OnyxUpdates.ts b/src/libs/actions/OnyxUpdates.ts index 2f209a0f0d104..dfc197369880f 100644 --- a/src/libs/actions/OnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdates.ts @@ -183,6 +183,7 @@ function saveUpdateInformation(updateParams: OnyxUpdatesFr modifiedUpdateParams = {...modifiedUpdateParams, request: {...updateParams.request, data: {apiRequestType: updateParams.request?.data?.apiRequestType}}}; } // Always use set() here so that the updateParams are never merged and always unique to the request that came in + // eslint-disable-next-line @typescript-eslint/no-explicit-any Onyx.set(ONYXKEYS.ONYX_UPDATES_FROM_SERVER, modifiedUpdateParams as AnyOnyxUpdatesFromServer); } @@ -218,5 +219,6 @@ function doesClientNeedToBeUpdated({previousUpdateID, clientLastUpdateID}: DoesC return false; } +// eslint-disable-next-line import/prefer-default-export export {apply, doesClientNeedToBeUpdated, saveUpdateInformation, applyHTTPSOnyxUpdates as INTERNAL_DO_NOT_USE_applyHTTPSOnyxUpdates}; export type {DoesClientNeedToBeUpdatedParams as ManualOnyxUpdateCheckIds}; diff --git a/src/libs/actions/PaymentMethods.ts b/src/libs/actions/PaymentMethods.ts index 5a12949a8d4d0..a860f5b734a25 100644 --- a/src/libs/actions/PaymentMethods.ts +++ b/src/libs/actions/PaymentMethods.ts @@ -89,6 +89,7 @@ function getMakeDefaultPaymentOnyxData( onyxMethod: Onyx.METHOD.MERGE, key: ONYXKEYS.USER_WALLET, value: { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing walletLinkedAccountID: bankAccountID || fundID, walletLinkedAccountType: bankAccountID ? CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT : CONST.PAYMENT_METHODS.DEBIT_CARD, // Only clear the error if this is optimistic data. If this is failure data, we do not want to clear the error that came from the server. @@ -99,6 +100,7 @@ function getMakeDefaultPaymentOnyxData( onyxMethod: Onyx.METHOD.MERGE, key: ONYXKEYS.USER_WALLET, value: { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing walletLinkedAccountID: bankAccountID || fundID, walletLinkedAccountType: bankAccountID ? CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT : CONST.PAYMENT_METHODS.DEBIT_CARD, }, @@ -258,6 +260,7 @@ function addSubscriptionPaymentCard( if (CONST.SCA_CURRENCIES.has(currency)) { addPaymentCardSCA(parameters, {optimisticData, successData, failureData}); } else { + // eslint-disable-next-line rulesdir/no-multiple-api-calls API.write(WRITE_COMMANDS.ADD_PAYMENT_CARD, parameters, { optimisticData, successData, diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 6e92e4860bbf6..9fc79c36d9171 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -1469,6 +1469,7 @@ function addBillingCardAndRequestPolicyOwnerChange( addressZip, currency: currency as ValueOf, }; + // eslint-disable-next-line rulesdir/no-multiple-api-calls API.write(WRITE_COMMANDS.ADD_BILLING_CARD_AND_REQUEST_WORKSPACE_OWNER_CHANGE, params, {optimisticData, successData, failureData}); } } @@ -2195,10 +2196,12 @@ function generateDefaultWorkspaceName(email = ''): string { const isSMSDomain = `@${domain}` === CONST.SMS.DOMAIN; if (isSMSDomain) { + // eslint-disable-next-line @typescript-eslint/no-deprecated displayNameForWorkspace = translateLocal('workspace.new.myGroupWorkspace', {}); } if (isEmptyObject(deprecatedAllPolicies)) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return isSMSDomain ? translateLocal('workspace.new.myGroupWorkspace', {}) : translateLocal('workspace.new.workspaceName', displayNameForWorkspace); } @@ -2217,8 +2220,10 @@ function generateDefaultWorkspaceName(email = ''): string { const lastWorkspaceNumber = workspaceNumbers.length > 0 ? Math.max(...workspaceNumbers) : undefined; if (isSMSDomain) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('workspace.new.myGroupWorkspace', {workspaceNumber: lastWorkspaceNumber !== undefined ? lastWorkspaceNumber + 1 : undefined}); } + // eslint-disable-next-line @typescript-eslint/no-deprecated return translateLocal('workspace.new.workspaceName', displayNameForWorkspace, lastWorkspaceNumber !== undefined ? lastWorkspaceNumber + 1 : undefined); } @@ -3107,6 +3112,7 @@ function buildDuplicatePolicyData(policy: Policy, options: DuplicatePolicyDataOp policyCategories && isCategoriesOptionSelected ? buildOptimisticPolicyWithExistingCategories(targetPolicyID, policyCategories) : defaultOptimisticCategoriesData; // WARNING: The data below should be kept in sync with the API so we create the policy with the correct configuration. + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const optimisticData: Array< OnyxUpdate< | typeof ONYXKEYS.COLLECTION.POLICY @@ -3835,6 +3841,7 @@ function requestExpensifyCardLimitIncrease(settlementBankAccountID?: number) { function updateMemberCustomField(policyID: string, login: string, customFieldType: CustomFieldType, value: string) { const customFieldKey = CONST.CUSTOM_FIELD_KEYS[customFieldType]; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const previousValue = policy?.employeeList?.[login]?.[customFieldKey]; @@ -3898,6 +3905,7 @@ function dismissAddedWithPrimaryLoginMessages(policyID: string) { * * @returns policyID of the workspace we have created */ +// eslint-disable-next-line rulesdir/no-call-actions-from-actions function createWorkspaceFromIOUPayment( iouReport: OnyxEntry, reportPreviewAction: ReportAction | undefined, @@ -4690,6 +4698,7 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { ], }; // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const shouldAddDefaultTaxRatesData = (!policy?.taxRates || isEmptyObject(policy.taxRates)) && enabled; @@ -4757,6 +4766,7 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { function enablePolicyWorkflows(policyID: string, enabled: boolean) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const onyxData: OnyxData = { optimisticData: [ @@ -4857,6 +4867,7 @@ const DISABLED_MAX_EXPENSE_VALUES: Pick = { optimisticData: [ @@ -4934,6 +4945,7 @@ function enablePolicyRules(policyID: string, enabled: boolean, shouldGoBack = tr function enableDistanceRequestTax(policyID: string, customUnitName: string, customUnitID: string, attributes: Attributes) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const onyxData: OnyxData = { optimisticData: [ @@ -5165,6 +5177,7 @@ function openPolicyInitialPage(policyID: string) { function setPolicyCustomTaxName(policyID: string, customTaxName: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalCustomTaxName = policy?.taxRates?.name; const onyxData: OnyxData = { @@ -5218,6 +5231,7 @@ function setPolicyCustomTaxName(policyID: string, customTaxName: string) { function setWorkspaceCurrencyDefault(policyID: string, taxCode: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalDefaultExternalID = policy?.taxRates?.defaultExternalID; const onyxData: OnyxData = { @@ -5271,6 +5285,7 @@ function setWorkspaceCurrencyDefault(policyID: string, taxCode: string) { function setForeignCurrencyDefault(policyID: string, taxCode: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalDefaultForeignCurrencyID = policy?.taxRates?.foreignTaxDefault; const onyxData: OnyxData = { @@ -5324,6 +5339,7 @@ function setForeignCurrencyDefault(policyID: string, taxCode: string) { function upgradeToCorporate(policyID: string, featureName?: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const optimisticData: Array> = [ { @@ -5382,6 +5398,7 @@ function upgradeToCorporate(policyID: string, featureName?: string) { function downgradeToTeam(policyID: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const optimisticData: Array> = [ { @@ -5424,6 +5441,7 @@ function downgradeToTeam(policyID: string) { function setWorkspaceDefaultSpendCategory(policyID: string, groupID: string, category: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); if (!policy) { return; @@ -5494,6 +5512,7 @@ function setWorkspaceDefaultSpendCategory(policyID: string, groupID: string, cat */ function setPolicyMaxExpenseAmountNoReceipt(policyID: string, maxExpenseAmountNoReceipt: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const parsedMaxExpenseAmountNoReceipt = maxExpenseAmountNoReceipt === '' ? CONST.DISABLED_MAX_EXPENSE_VALUE : CurrencyUtils.convertToBackendAmount(parseFloat(maxExpenseAmountNoReceipt)); const originalMaxExpenseAmountNoReceipt = policy?.maxExpenseAmountNoReceipt; @@ -5548,6 +5567,7 @@ function setPolicyMaxExpenseAmountNoReceipt(policyID: string, maxExpenseAmountNo * @param maxExpenseAmountNoItemizedReceipt - new value of the itemized receipt required amount */ function setPolicyMaxExpenseAmountNoItemizedReceipt(policyID: string, maxExpenseAmountNoItemizedReceipt: string) { + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const parsedMaxExpenseAmountNoItemizedReceipt = maxExpenseAmountNoItemizedReceipt === '' ? CONST.DISABLED_MAX_EXPENSE_VALUE : CurrencyUtils.convertToBackendAmount(parseFloat(maxExpenseAmountNoItemizedReceipt)); @@ -5604,6 +5624,7 @@ function setPolicyMaxExpenseAmountNoItemizedReceipt(policyID: string, maxExpense */ function setPolicyMaxExpenseAmount(policyID: string, maxExpenseAmount: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const parsedMaxExpenseAmount = maxExpenseAmount === '' ? CONST.DISABLED_MAX_EXPENSE_VALUE : CurrencyUtils.convertToBackendAmount(parseFloat(maxExpenseAmount)); const originalMaxExpenseAmount = policy?.maxExpenseAmount; @@ -5659,6 +5680,7 @@ function setPolicyMaxExpenseAmount(policyID: string, maxExpenseAmount: string) { */ function setPolicyProhibitedExpense(policyID: string, prohibitedExpense: keyof ProhibitedExpenses) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalProhibitedExpenses = policy?.prohibitedExpenses; const prohibitedExpenses = { @@ -5724,6 +5746,7 @@ function setPolicyProhibitedExpense(policyID: string, prohibitedExpense: keyof P */ function setPolicyMaxExpenseAge(policyID: string, maxExpenseAge: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const parsedMaxExpenseAge = maxExpenseAge === '' ? CONST.DISABLED_MAX_EXPENSE_VALUE : parseInt(maxExpenseAge, 10); const originalMaxExpenseAge = policy?.maxExpenseAge; @@ -5780,6 +5803,7 @@ function setPolicyMaxExpenseAge(policyID: string, maxExpenseAge: string) { */ function updateCustomRules(policyID: string, customRules: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalCustomRules = policy?.customRules; const parsedCustomRules = ReportUtils.getParsedComment(customRules); @@ -5844,6 +5868,7 @@ function updateCustomRules(policyID: string, customRules: string) { */ function setPolicyBillableMode(policyID: string, defaultBillable: boolean) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalDefaultBillable = policy?.defaultBillable; @@ -6002,6 +6027,7 @@ function setPolicyReimbursableMode(policyID: string, reimbursableMode: PolicyCas */ function disableWorkspaceBillableExpenses(policyID: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalDefaultBillableDisabled = policy?.disabledFields?.defaultBillable; @@ -6052,6 +6078,7 @@ function disableWorkspaceBillableExpenses(policyID: string) { function getWorkspaceEReceiptsEnabledOnyxData(policyID: string, enabled: boolean): OnyxData { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalEReceipts = policy?.eReceipts; @@ -6157,6 +6184,7 @@ function setPolicyRequireCompanyCardsEnabled(policy: Policy, requireCompanyCards function setPolicyAttendeeTrackingEnabled(policyID: string, isAttendeeTrackingEnabled: boolean) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const originalIsAttendeeTrackingEnabled = !!policy?.isAttendeeTrackingEnabled; @@ -6228,6 +6256,7 @@ function getAdminPoliciesConnectedToNetSuite(): Policy[] { */ function setPolicyDefaultReportTitle(policyID: string, customName: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); if (customName === policy?.fieldList?.[CONST.POLICY.FIELDS.FIELD_LIST_TITLE]?.defaultValue) { @@ -6302,6 +6331,7 @@ function setPolicyDefaultReportTitle(policyID: string, customName: string) { */ function setPolicyPreventMemberCreatedTitle(policyID: string, enforced: boolean) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); // When fieldList is empty, deletable is undefined. We treat undefined as true (not enforced) to match OldDot's fallback behavior. @@ -6371,6 +6401,7 @@ function setPolicyPreventMemberCreatedTitle(policyID: string, enforced: boolean) */ function setPolicyPreventSelfApproval(policyID: string, preventSelfApproval: boolean) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); if (preventSelfApproval === policy?.preventSelfApproval) { @@ -6438,6 +6469,7 @@ function setPolicyPreventSelfApproval(policyID: string, preventSelfApproval: boo */ function setPolicyAutomaticApprovalLimit(policyID: string, limit: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const fallbackLimit = limit === '' ? '0' : limit; @@ -6512,6 +6544,7 @@ function setPolicyAutomaticApprovalLimit(policyID: string, limit: string) { */ function setPolicyAutomaticApprovalRate(policyID: string, auditRate: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const fallbackAuditRate = auditRate === '' ? '0' : auditRate; const parsedAuditRate = parseInt(fallbackAuditRate, 10) / 100; @@ -6588,6 +6621,7 @@ function setPolicyAutomaticApprovalRate(policyID: string, auditRate: string) { */ function enableAutoApprovalOptions(policyID: string, enabled: boolean) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); if (enabled === policy?.shouldShowAutoApprovalOptions) { @@ -6665,6 +6699,7 @@ function enableAutoApprovalOptions(policyID: string, enabled: boolean) { */ function setPolicyAutoReimbursementLimit(policyID: string, limit: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const fallbackLimit = limit === '' ? '0' : limit; const parsedLimit = CurrencyUtils.convertToBackendAmount(parseFloat(fallbackLimit)); @@ -6737,6 +6772,7 @@ function setPolicyAutoReimbursementLimit(policyID: string, limit: string) { */ function enablePolicyAutoReimbursementLimit(policyID: string, enabled: boolean) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); if (enabled === policy?.shouldShowAutoReimbursementLimitOption) { @@ -6815,6 +6851,7 @@ function clearAllPolicies() { function updateInvoiceCompanyName(policyID: string, companyName: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const optimisticData: Array> = [ @@ -6871,6 +6908,7 @@ function updateInvoiceCompanyName(policyID: string, companyName: string) { function updateInvoiceCompanyWebsite(policyID: string, companyWebsite: string) { // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated const policy = getPolicy(policyID); const optimisticData: Array> = [ diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts index a130ad354d6fb..9a80202ec08cf 100644 --- a/src/libs/actions/Report/index.ts +++ b/src/libs/actions/Report/index.ts @@ -809,6 +809,7 @@ function addActions({ for (const [actionKey, action] of Object.entries(optimisticReportActions)) { failureReportActions[actionKey] = { + // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style ...(action as OptimisticAddCommentReportAction), errors: getMicroSecondOnyxErrorWithTranslationKey('report.genericAddCommentFailureMessage'), }; @@ -3344,6 +3345,7 @@ function buildNewReportOptimisticData( }; // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: optimisticReportData, predictedNextStatus: CONST.REPORT.STATUS_NUM.OPEN, @@ -3725,6 +3727,7 @@ function navigateToConciergeChatAndDeleteReport( Navigation.goBack(); } navigateToConciergeChat(conciergeReportID, deprecatedIntroSelected, currentUserAccountID, false); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { deleteReport(reportID, shouldDeleteChildReports); }); @@ -6251,6 +6254,7 @@ function navigateToTrainingModal(isChangePolicyTrainingModalDismissed: boolean, return; } + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { Navigation.navigate(ROUTES.CHANGE_POLICY_EDUCATIONAL.getRoute(ROUTES.REPORT_WITH_ID.getRoute(reportID))); }); @@ -6349,6 +6353,7 @@ function buildOptimisticChangePolicyData( if (newStatusNum != null && newStatusNum !== undefined) { // buildOptimisticNextStep is used in parallel + // eslint-disable-next-line @typescript-eslint/no-deprecated const optimisticNextStepDeprecated = buildNextStepNew({ report: {...report, policyID: policy.id}, predictedNextStatus: newStatusNum, diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 1399241f31c5f..d575d9c8c1160 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -233,6 +233,7 @@ function removeWaypoint(transaction: OnyxEntry, currentIndex: strin // to remove nested keys while also preserving other object keys // Doing a deep clone of the transaction to avoid mutating the original object and running into a cache issue when using Onyx.set let newTransaction: Transaction = { + // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style ...currentTransaction, comment: { ...currentTransaction?.comment, diff --git a/src/libs/actions/Wallet.ts b/src/libs/actions/Wallet.ts index 94de9915cb6d4..d19bfb759688b 100644 --- a/src/libs/actions/Wallet.ts +++ b/src/libs/actions/Wallet.ts @@ -251,7 +251,7 @@ function resetWalletAdditionalDetailsDraft() { } function issuerEncryptPayloadCallback(nonce: string, nonceSignature: string, certificates: string[], cardID: number): Promise { - // eslint-disable-next-line rulesdir/no-api-side-effects-method + // eslint-disable-next-line rulesdir/no-api-side-effects-method, rulesdir/no-api-in-views return API.makeRequestWithSideEffects(SIDE_EFFECT_REQUEST_COMMANDS.CREATE_DIGITAL_WALLET, { platform: 'ios', appVersion: pkg.version, diff --git a/src/libs/fileDownload/DownloadUtils.ts b/src/libs/fileDownload/DownloadUtils.ts index cb64cfdf03eda..63e04ff90aeb0 100644 --- a/src/libs/fileDownload/DownloadUtils.ts +++ b/src/libs/fileDownload/DownloadUtils.ts @@ -12,6 +12,7 @@ const createDownloadLink = (href: string, fileName: string) => { link.href = href; link.style.display = 'none'; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- Disabling this line for safeness as nullish coalescing works only if the value is undefined or null, and since fileName can be an empty string we want to default to `FileUtils.getFileName(url)` link.download = fileName; // Append to html link element page diff --git a/src/libs/fileDownload/FileUtils.ts b/src/libs/fileDownload/FileUtils.ts index e2e943890e24c..8b48f565e7f87 100644 --- a/src/libs/fileDownload/FileUtils.ts +++ b/src/libs/fileDownload/FileUtils.ts @@ -469,6 +469,7 @@ function isHighResolutionImage(resolution: {width: number; height: number} | nul * Reads image dimensions directly from the file header (JPEG SOF marker or PNG IHDR chunk). * This bypasses browser Image API which may downsample large images on mobile browsers. */ +// eslint-disable-next-line no-bitwise const getImageDimensionsFromFileHeader = (blob: Blob): Promise<{width: number; height: number} | null> => { return new Promise((resolve) => { const reader = new FileReader(); diff --git a/src/libs/mergeRefs.ts b/src/libs/mergeRefs.ts index 395257dc50116..ef9a71b6b4d17 100644 --- a/src/libs/mergeRefs.ts +++ b/src/libs/mergeRefs.ts @@ -10,6 +10,7 @@ export default function mergeRefs(...refs: Array | Ref if (typeof ref === 'function') { ref(value); } else if (ref != null) { + // eslint-disable-next-line no-param-reassign (ref as RefObject).current = value; } } diff --git a/src/libs/migrateOnyx.ts b/src/libs/migrateOnyx.ts index aafcad5688b3e..094c1c972082d 100644 --- a/src/libs/migrateOnyx.ts +++ b/src/libs/migrateOnyx.ts @@ -20,6 +20,7 @@ export default function () { // Reduce all promises down to a single promise. All promises run in a linear fashion, waiting for the // previous promise to finish before moving onto the next one. + /* eslint-disable arrow-body-style */ migrationPromises .reduce>((previousPromise, migrationPromise) => { return previousPromise.then(() => { diff --git a/src/libs/models/BankAccount.ts b/src/libs/models/BankAccount.ts index 6229e78d8a572..8c3cf67e42bb8 100644 --- a/src/libs/models/BankAccount.ts +++ b/src/libs/models/BankAccount.ts @@ -125,6 +125,7 @@ class BankAccount { * @NOTE WARNING KEEP IN SYNC WITH THE PHP */ getClientID() { + // eslint-disable-next-line max-len return `${Str.makeID(this.getMaskedAccountNumber() ?? '')}${Str.makeID(this.getAddressName() ?? '')}${Str.makeID(this.getRoutingNumber() ?? '')}${this.getTransactionType()}`; } diff --git a/src/libs/telemetry/forwardLogsToSentry.ts b/src/libs/telemetry/forwardLogsToSentry.ts index 05322d3069b8b..f0b009d07b246 100644 --- a/src/libs/telemetry/forwardLogsToSentry.ts +++ b/src/libs/telemetry/forwardLogsToSentry.ts @@ -11,6 +11,7 @@ const PARAMETERS_WHITELIST = new Set(['timestamp', 'spanExists', 'spanId', 'span * Currently, this always returns false because we want to deliberately decide what is being forwarded. * There is no redaction / filtering of sensitive data implemented yet. When you implement any log forwarding logic, make sure that you do not leak any sensitive data. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars function shouldForwardLog(log: {message?: string; parameters?: Record | undefined}) { if (log.message?.includes('[Sentry]')) { return true; diff --git a/src/pages/EditReportFieldPage.tsx b/src/pages/EditReportFieldPage.tsx index a3c627b538052..b33809f497236 100644 --- a/src/pages/EditReportFieldPage.tsx +++ b/src/pages/EditReportFieldPage.tsx @@ -114,9 +114,11 @@ function EditReportFieldPage({route}: EditReportFieldPageProps) { }; // Provide a default when the report name and the policy field list are empty + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ const fieldValue = isReportFieldTitle ? getReportNameFromReportNameUtils(report, reportAttributesByReportID) || (isPolicyFieldListEmpty(policy) ? CONST.REPORT.DEFAULT_EXPENSE_REPORT_NAME : '') : (reportField.value ?? reportField.defaultValue); + /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */ const handleReportFieldChange = (form: FormOnyxValues) => { const value = form[fieldKey]; diff --git a/src/pages/EnablePayments/EnablePaymentsPage.tsx b/src/pages/EnablePayments/EnablePaymentsPage.tsx index 3a850edb8f23e..844b16a0f7fc0 100644 --- a/src/pages/EnablePayments/EnablePaymentsPage.tsx +++ b/src/pages/EnablePayments/EnablePaymentsPage.tsx @@ -34,6 +34,7 @@ function EnablePaymentsPage() { return; } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (isPendingOnfidoResult || hasFailedOnfido) { Navigation.navigate(ROUTES.SETTINGS_WALLET, {forceReplace: true}); return; diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 7668d5a1d51dc..ef0ac24085864 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -234,6 +234,7 @@ function NewChatPage({ref}: NewChatPageProps) { const {translate} = useLocalize(); const {isOffline} = useNetwork(); // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to show offline indicator on small screen only + // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const styles = useThemeStyles(); const personalData = useCurrentUserPersonalDetails(); const currentUserAccountID = personalData.accountID; diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index 016f48f495e69..2ec93823609b8 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -110,6 +110,7 @@ function ProfilePage({route}: ProfilePageProps) { } const displayName = formatPhoneNumber(getDisplayNameOrDefault(details, undefined, undefined, isCurrentUser, translate('common.you').toLowerCase())); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const fallbackIcon = details?.fallbackIcon ?? ''; const login = details?.login ?? ''; const timezone = details?.timezone; diff --git a/src/pages/ReimbursementAccount/EnterSignerInfo/index.tsx b/src/pages/ReimbursementAccount/EnterSignerInfo/index.tsx index b1e77c0577ae8..386ba8ad9806a 100644 --- a/src/pages/ReimbursementAccount/EnterSignerInfo/index.tsx +++ b/src/pages/ReimbursementAccount/EnterSignerInfo/index.tsx @@ -55,6 +55,7 @@ function EnterSignerInfo({route}: EnterSignerInfoProps) { } = useSubStep({bodyContent, startFrom: 0, onFinished: submit}); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (enterSignerInfoForm?.errors || enterSignerInfoForm?.isSavingSignerInformation || !enterSignerInfoForm?.isSuccess) { return; } diff --git a/src/pages/ReimbursementAccount/NonUSD/Agreements/index.tsx b/src/pages/ReimbursementAccount/NonUSD/Agreements/index.tsx index 05616e480d895..60aac835d3871 100644 --- a/src/pages/ReimbursementAccount/NonUSD/Agreements/index.tsx +++ b/src/pages/ReimbursementAccount/NonUSD/Agreements/index.tsx @@ -59,6 +59,7 @@ function Agreements({onBackButtonPress, onSubmit, stepNames, policyCurrency}: Ag return; } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (reimbursementAccount?.errors || reimbursementAccount?.isFinishingCorpayBankAccountOnboarding || !reimbursementAccount?.isSuccess) { return; } diff --git a/src/pages/ReimbursementAccount/NonUSD/BeneficialOwnerInfo/BeneficialOwnerInfo.tsx b/src/pages/ReimbursementAccount/NonUSD/BeneficialOwnerInfo/BeneficialOwnerInfo.tsx index 4af462f930e66..2b28c5111ebe2 100644 --- a/src/pages/ReimbursementAccount/NonUSD/BeneficialOwnerInfo/BeneficialOwnerInfo.tsx +++ b/src/pages/ReimbursementAccount/NonUSD/BeneficialOwnerInfo/BeneficialOwnerInfo.tsx @@ -91,6 +91,7 @@ function BeneficialOwnerInfo({onBackButtonPress, onSubmit, stepNames}: Beneficia }; useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (reimbursementAccount?.errors || reimbursementAccount?.isSavingCorpayOnboardingBeneficialOwnersFields || !reimbursementAccount?.isSuccess) { return; } diff --git a/src/pages/ReimbursementAccount/NonUSD/BusinessInfo/BusinessInfo.tsx b/src/pages/ReimbursementAccount/NonUSD/BusinessInfo/BusinessInfo.tsx index 050ad9cae274a..c7e2d3e5f5d9f 100644 --- a/src/pages/ReimbursementAccount/NonUSD/BusinessInfo/BusinessInfo.tsx +++ b/src/pages/ReimbursementAccount/NonUSD/BusinessInfo/BusinessInfo.tsx @@ -112,6 +112,7 @@ function BusinessInfo({onBackButtonPress, onSubmit, stepNames}: BusinessInfoProp }, [businessInfoStepValues, isProduction, country, currency, isBusinessTypeRequired, bankAccountID]); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (reimbursementAccount?.errors || reimbursementAccount?.isSavingCorpayOnboardingCompanyFields || !reimbursementAccount?.isSuccess) { return; } diff --git a/src/pages/ReimbursementAccount/NonUSD/Docusign/index.tsx b/src/pages/ReimbursementAccount/NonUSD/Docusign/index.tsx index 08e223cfc3d8e..71cdd722fa18a 100644 --- a/src/pages/ReimbursementAccount/NonUSD/Docusign/index.tsx +++ b/src/pages/ReimbursementAccount/NonUSD/Docusign/index.tsx @@ -50,6 +50,7 @@ function Docusign({onBackButtonPress, onSubmit, stepNames, policyCurrency}: Docu }; useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (reimbursementAccount?.errors || reimbursementAccount?.isFinishingCorpayBankAccountOnboarding || !reimbursementAccount?.isSuccess) { return; } diff --git a/src/pages/ReimbursementAccount/NonUSD/SignerInfo/HangTight.tsx b/src/pages/ReimbursementAccount/NonUSD/SignerInfo/HangTight.tsx index fde044c1ec8c3..d3d9ce6d84794 100644 --- a/src/pages/ReimbursementAccount/NonUSD/SignerInfo/HangTight.tsx +++ b/src/pages/ReimbursementAccount/NonUSD/SignerInfo/HangTight.tsx @@ -44,6 +44,7 @@ function HangTight({policyID, bankAccountID}: HangTightProps) { }; useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (reimbursementAccount?.errors || reimbursementAccount?.isSendingReminderForCorpaySignerInformation || !reimbursementAccount?.isSuccess) { return; } diff --git a/src/pages/ReimbursementAccount/NonUSD/SignerInfo/index.tsx b/src/pages/ReimbursementAccount/NonUSD/SignerInfo/index.tsx index 1c2b46ee5d9d8..869e46213f2ce 100644 --- a/src/pages/ReimbursementAccount/NonUSD/SignerInfo/index.tsx +++ b/src/pages/ReimbursementAccount/NonUSD/SignerInfo/index.tsx @@ -46,6 +46,7 @@ type EmailSubmitParams = { type SignerDetailsFormProps = SubStepProps; +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment const SUBSTEP: Record = CONST.NON_USD_BANK_ACCOUNT.SIGNER_INFO_STEP.SUBSTEP; const {OWNS_MORE_THAN_25_PERCENT, COMPANY_NAME, SIGNER_EMAIL, SIGNER_FULL_NAME, SECOND_SIGNER_EMAIL} = INPUT_IDS.ADDITIONAL_DATA.CORPAY; @@ -86,6 +87,7 @@ function SignerInfo({onBackButtonPress, onSubmit, stepNames}: SignerInfoProps) { }, [bankAccountID, isUserOwner, reimbursementAccountDraft, signerEmail]); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (reimbursementAccount?.errors || reimbursementAccount?.isSavingCorpayOnboardingDirectorInformation || !reimbursementAccount?.isSuccess) { return; } @@ -106,6 +108,7 @@ function SignerInfo({onBackButtonPress, onSubmit, stepNames}: SignerInfoProps) { }, [reimbursementAccount?.errors, reimbursementAccount?.isSavingCorpayOnboardingDirectorInformation, reimbursementAccount?.isSuccess, onSubmit, currency, currentSubStep]); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (reimbursementAccount?.errors || reimbursementAccount?.isAskingForCorpaySignerInformation || !reimbursementAccount?.isAskingForCorpaySignerInformationSuccess) { return; } diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index 3081ff5da6bc6..ccd3a0e15311c 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -155,6 +155,7 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}: clearReimbursementAccount(); getPaymentMethods(true); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index a162f1a06474a..276eaee04838c 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -185,6 +185,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {isSmallScreenWidth} = useResponsiveLayout(); + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(transactionThreadReportID)}`); const [isDebugModeEnabled = false] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED); const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); @@ -224,6 +225,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail const parentNavigationSubtitleData = getParentNavigationSubtitle(report, isParentReportArchived); const base62ReportID = getBase62ReportID(Number(report.reportID)); const ancestors = useAncestors(report); + // eslint-disable-next-line react-hooks/exhaustive-deps -- policy is a dependency because `getChatRoomSubtitle` calls `getPolicyName` which in turn retrieves the value from the `policy` value stored in Onyx const chatRoomSubtitle = useMemo(() => { const subtitle = getChatRoomSubtitle(report, false, isReportArchived); diff --git a/src/pages/ScheduleCall/ScheduleCallPage.tsx b/src/pages/ScheduleCall/ScheduleCallPage.tsx index cca1968dd8196..feae37380eaee 100644 --- a/src/pages/ScheduleCall/ScheduleCallPage.tsx +++ b/src/pages/ScheduleCall/ScheduleCallPage.tsx @@ -132,6 +132,7 @@ function ScheduleCallPage() { const timeSlotsForSelectedData = scheduleCallDraft?.date ? (timeSlotDateMap?.[scheduleCallDraft?.date] ?? []) : []; useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (calendlySchedule?.isLoading || !firstDate || scheduleCallDraft?.date) { return; } diff --git a/src/pages/ShareCodePage.tsx b/src/pages/ShareCodePage.tsx index ae18b83bbf7f5..b3a3ca80f63f8 100644 --- a/src/pages/ShareCodePage.tsx +++ b/src/pages/ShareCodePage.tsx @@ -165,6 +165,7 @@ function ShareCodePage({report, policy, backTo}: ShareCodePageProps) { isAnonymousAction title={translate('common.download')} icon={icons.Download} + // eslint-disable-next-line @typescript-eslint/no-misused-promises onPress={() => qrCodeRef.current?.download?.()} /> )} diff --git a/src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx b/src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx index 6cdcaffb37870..d293b94ddb22e 100644 --- a/src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx +++ b/src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx @@ -37,6 +37,7 @@ function DuplicateTransactionItem({transaction, index, policies, onPreviewPresse const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT); const isTryNewDotNVPDismissed = !!tryNewDot?.classicRedirect?.dismissed; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/non-nullable-type-assertion-style const action = Object.values(reportActions ?? {})?.find((reportAction) => { const IOUTransactionID = isMoneyRequestAction(reportAction) ? getOriginalMessage(reportAction)?.IOUTransactionID : CONST.DEFAULT_NUMBER_ID; return IOUTransactionID === transaction?.transactionID; diff --git a/src/pages/domain/DomainNotFoundPageWrapper.tsx b/src/pages/domain/DomainNotFoundPageWrapper.tsx index 39c029f583ff4..9ef6da3e610de 100644 --- a/src/pages/domain/DomainNotFoundPageWrapper.tsx +++ b/src/pages/domain/DomainNotFoundPageWrapper.tsx @@ -37,6 +37,7 @@ function DomainNotFoundPageWrapper({domainAccountID, shouldBeBlocked, fullPageNo const shouldShowNotFoundPage = !domain || !isAdmin || shouldBeBlocked; useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (shouldShowFullScreenLoadingIndicator || (domain && isAdmin)) { return; } diff --git a/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx index dbd04236e6b65..cdd2b00540366 100755 --- a/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -453,6 +453,7 @@ function BaseReportActionContextMenu({ ); } +// eslint-disable-next-line rulesdir/no-deep-equal-in-memo export default memo(BaseReportActionContextMenu, deepEqual); export type {BaseReportActionContextMenuProps}; diff --git a/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx b/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx index d7353eb181b63..11c9d8fd4968f 100644 --- a/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx @@ -1258,6 +1258,7 @@ const ContextMenuActions: ContextMenuAction[] = [ }, onPress: (closePopover, {reportID: reportIDParam, reportAction, moneyRequestAction}) => { const iouReportID = isMoneyRequestAction(moneyRequestAction) ? getOriginalMessage(moneyRequestAction)?.IOUReportID : undefined; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const reportID = iouReportID && Number(iouReportID) !== 0 ? iouReportID : reportIDParam; if (closePopover) { // Hide popover, then call showDeleteConfirmModal diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 1ba1a1e4c1f19..9b858c23d0418 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -592,6 +592,7 @@ function PureReportActionItem({ const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.chatReportID)}`); const highlightedBackgroundColorIfNeeded = useMemo( + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing () => (isReportActionLinked || shouldHighlight ? StyleUtils.getBackgroundColorStyle(theme.messageHighlightBG) : {}), [StyleUtils, isReportActionLinked, theme.messageHighlightBG, shouldHighlight], ); @@ -751,6 +752,7 @@ function PureReportActionItem({ return; } + // eslint-disable-next-line @typescript-eslint/naming-convention popoverAnchorRef.current?.measureInWindow((_fx, frameY, _width, height) => { transitionActionSheetState({ type: ActionSheetAwareScrollView.Actions.OPEN_POPOVER, @@ -2100,6 +2102,7 @@ function PureReportActionItem({ { // update ref with current state prevShouldUseNarrowLayoutRef.current = shouldUseNarrowLayout; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [shouldUseNarrowLayout, reportActions, isReportFullyVisible]); const allReportActionIDs = useMemo(() => { diff --git a/src/pages/inbox/report/ReportTypingIndicator.tsx b/src/pages/inbox/report/ReportTypingIndicator.tsx index bdc47a67df07c..79436d6bed675 100755 --- a/src/pages/inbox/report/ReportTypingIndicator.tsx +++ b/src/pages/inbox/report/ReportTypingIndicator.tsx @@ -36,6 +36,7 @@ function ReportTypingIndicator({reportID}: ReportTypingIndicatorProps) { if (usersTyping.length === 1) { return ( (WrappedComponent: ComponentType): ComponentType { function WithReportOrNotFound(props: TProps) { const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.parentReportID)}`); const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`); const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA); @@ -76,6 +77,7 @@ export default function ; } diff --git a/src/pages/inbox/sidebar/SidebarLinks.tsx b/src/pages/inbox/sidebar/SidebarLinks.tsx index ca50f7672fc14..f4e1249cb4c82 100644 --- a/src/pages/inbox/sidebar/SidebarLinks.tsx +++ b/src/pages/inbox/sidebar/SidebarLinks.tsx @@ -43,6 +43,7 @@ function SidebarLinks({insets, optionListItems, isLoading, priorityMode = CONST. useEffect(() => { ReportActionContextMenu.hideContextMenu(false); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); /** diff --git a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx index a425173d45cbc..afb945b554611 100644 --- a/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx +++ b/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx @@ -83,6 +83,7 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde keyForList: String(attendee.accountID) ?? (attendee.email || attendee.displayName), selected: true, // Use || to fall back to displayName for name-only attendees (empty email) + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing login: attendee.email || attendee.displayName, ...getPersonalDetailByEmail(attendee.email), })); diff --git a/src/pages/iou/request/step/IOURequestStepAmount.tsx b/src/pages/iou/request/step/IOURequestStepAmount.tsx index 7bec129ceb730..3d1bf34fb753e 100644 --- a/src/pages/iou/request/step/IOURequestStepAmount.tsx +++ b/src/pages/iou/request/step/IOURequestStepAmount.tsx @@ -196,6 +196,7 @@ function IOURequestStepAmount({ isSaveButtonPressed.current = true; const amountInSmallestCurrencyUnits = convertToBackendAmount(Number.parseFloat(amount)); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing setMoneyRequestAmount(transactionID, amountInSmallestCurrencyUnits, selectedCurrency || CONST.CURRENCY.USD, shouldKeepUserInput); if (isMovingTransactionFromTrackExpense(action)) { diff --git a/src/pages/iou/request/step/IOURequestStepCategory.tsx b/src/pages/iou/request/step/IOURequestStepCategory.tsx index ad9bf323d004a..ee9af1e3ff085 100644 --- a/src/pages/iou/request/step/IOURequestStepCategory.tsx +++ b/src/pages/iou/request/step/IOURequestStepCategory.tsx @@ -90,6 +90,7 @@ function IOURequestStepCategory({ const shouldShowCategory = (isReportInGroupPolicy(report) || isGroupPolicy(policy?.type ?? '')) && // The transactionCategory can be an empty string, so to maintain the logic we'd like to keep it in this shape until utils refactor + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing (!!categoryForDisplay || hasEnabledOptions(Object.values(policyCategories ?? {}))); // eslint-disable-next-line rulesdir/no-negated-variables diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 6d22515da9e57..e34c62f7fbfb3 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -139,6 +139,7 @@ function IOURequestStepConfirmation({ // eslint-disable-next-line react-hooks/exhaustive-deps const transactionIDs = useMemo(() => transactions?.map((transaction) => transaction.transactionID), [transactions.length]); // We will use setCurrentTransactionID later to switch between transactions + // eslint-disable-next-line @typescript-eslint/no-unused-vars const [currentTransactionID, setCurrentTransactionID] = useState(initialTransactionID); const currentTransactionIndex = useMemo(() => transactions.findIndex((transaction) => transaction.transactionID === currentTransactionID), [transactions, currentTransactionID]); const [existingTransaction, existingTransactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(currentTransactionID)}`); diff --git a/src/pages/iou/request/step/IOURequestStepDistance.tsx b/src/pages/iou/request/step/IOURequestStepDistance.tsx index e10bb60612857..fdbde4599c518 100644 --- a/src/pages/iou/request/step/IOURequestStepDistance.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistance.tsx @@ -191,7 +191,8 @@ function IOURequestStepDistance({ const defaultMileageRate = DistanceRequestUtils.getDefaultMileageRate(IOUpolicy); const mileageRate: MileageRate | undefined = isCustomUnitRateIDForP2P(transaction) ? DistanceRequestUtils.getRateForP2P(policyCurrency, transaction) - : (customUnitRateID && mileageRates?.[customUnitRateID]) || defaultMileageRate; + : // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + (customUnitRateID && mileageRates?.[customUnitRateID]) || defaultMileageRate; const {unit, rate} = mileageRate ?? {}; const distance = getDistanceInMeters(transaction, unit); diff --git a/src/pages/iou/request/step/IOURequestStepDistanceMap.tsx b/src/pages/iou/request/step/IOURequestStepDistanceMap.tsx index 6ec47e3e7d7b1..39d0654a5ec7e 100644 --- a/src/pages/iou/request/step/IOURequestStepDistanceMap.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistanceMap.tsx @@ -187,7 +187,8 @@ function IOURequestStepDistanceMap({ const defaultMileageRate = DistanceRequestUtils.getDefaultMileageRate(IOUpolicy); const mileageRate: MileageRate | undefined = isCustomUnitRateIDForP2P(transaction) ? DistanceRequestUtils.getRateForP2P(policyCurrency, transaction) - : (customUnitRateID && mileageRates?.[customUnitRateID]) || defaultMileageRate; + : // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + (customUnitRateID && mileageRates?.[customUnitRateID]) || defaultMileageRate; const {unit, rate} = mileageRate ?? {}; const distance = getDistanceInMeters(transaction, unit); diff --git a/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx b/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx index c703e865ef0ba..3b0e987b60937 100644 --- a/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx @@ -53,12 +53,15 @@ function IOURequestStepDistanceRate({ transaction, }: IOURequestStepDistanceRateProps) { const [policyDraft] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${getIOURequestPolicyID(transaction, reportDraft)}`); + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ const [policyReal] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`); const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report?.policyID}`); const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${report?.policyID}`); const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.parentReportID)}`); const [parentReportNextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${getNonEmptyStringOnyxID(report?.parentReportID)}`); + /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */ + const [splitDraftTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`); const policy: OnyxEntry = policyReal ?? policyDraft; diff --git a/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx b/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx index b4fddf1138ab8..51d9e9347f512 100644 --- a/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx @@ -423,6 +423,7 @@ function IOURequestStepOdometerImage({ for (const file of files) { const blobUrl = URL.createObjectURL(file); blobUrls.push(blobUrl); + // eslint-disable-next-line no-param-reassign file.uri = blobUrl; } dropBlobUrlsRef.current = blobUrls; diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index db87e8183711c..fee22b5ff763d 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -287,6 +287,7 @@ function IOURequestStepScan({ return; } for (const file of files) { + // eslint-disable-next-line no-param-reassign file.uri = URL.createObjectURL(file); } diff --git a/src/pages/settings/Profile/Avatar/AvatarPage.tsx b/src/pages/settings/Profile/Avatar/AvatarPage.tsx index bd829746e0404..ce8f2dc1e275b 100644 --- a/src/pages/settings/Profile/Avatar/AvatarPage.tsx +++ b/src/pages/settings/Profile/Avatar/AvatarPage.tsx @@ -67,6 +67,7 @@ function ProfileAvatar() { const {avatarMap: avatars} = useLetterAvatars(currentUserPersonalDetails?.displayName, CONST.AVATAR_SIZE.X_LARGE); const accountID = currentUserPersonalDetails?.accountID ?? CONST.DEFAULT_NUMBER_ID; + // eslint-disable-next-line no-nested-ternary let avatarURL: AvatarSource = ''; if (selected && isPresetAvatarID(selected)) { avatarURL = getAvatarLocal(selected); diff --git a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx index 36bb10152610e..bb294a61f8cf4 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx +++ b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx @@ -140,6 +140,7 @@ function ContactMethodDetailsPage({route}: ContactMethodDetailsPageProps) { const prevValidatedDate = usePrevious(loginData?.validatedDate); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (prevValidatedDate || !loginData?.validatedDate) { return; } @@ -154,6 +155,7 @@ function ContactMethodDetailsPage({route}: ContactMethodDetailsPageProps) { }, [loginData?.validatedDate, loginData?.errorFields?.addedLogin]); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (!loginData?.partnerUserID || loginData?.validatedDate || prevPendingDeletedLogin) { return; } @@ -289,6 +291,7 @@ function ContactMethodDetailsPage({route}: ContactMethodDetailsPageProps) { { + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { validateCodeFormRef.current?.focus?.(); }); diff --git a/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/ValidateCodeForm/BaseValidateCodeForm.tsx index a5bb5faa8c6cc..c2ca634126e0e 100644 --- a/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/pages/settings/Security/AddDelegate/UpdateDelegateRole/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -62,6 +62,7 @@ function BaseValidateCodeForm({autoComplete = CONST.AUTO_COMPLETE_VARIANTS.ONE_T const inputValidateCodeRef = useRef(null); const [account] = useOnyx(ONYXKEYS.ACCOUNT); const login = account?.primaryLogin; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- nullish coalescing doesn't achieve the same result in this case const focusTimeoutRef = useRef(null); const currentDelegate = account?.delegatedAccess?.delegates?.find((d) => d.email === delegate); diff --git a/src/pages/settings/Security/TwoFactorAuth/CopyCodesPage.tsx b/src/pages/settings/Security/TwoFactorAuth/CopyCodesPage.tsx index e3fab6dab8af2..ef1cca6de8775 100644 --- a/src/pages/settings/Security/TwoFactorAuth/CopyCodesPage.tsx +++ b/src/pages/settings/Security/TwoFactorAuth/CopyCodesPage.tsx @@ -49,6 +49,7 @@ function CopyCodesPage({route}: TwoFactorAuthPageProps) { Navigation.navigate(ROUTES.SETTINGS_2FA_VERIFY_ACCOUNT.getRoute()); return; } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (isLoadingOnyxValue(accountMetadata) || account?.requiresTwoFactorAuth || account?.recoveryCodes || !isUserValidated) { return; } diff --git a/src/pages/settings/Wallet/EnableGlobalReimbursements/index.tsx b/src/pages/settings/Wallet/EnableGlobalReimbursements/index.tsx index 4a87808e4eba9..0dfd0e7fd3964 100644 --- a/src/pages/settings/Wallet/EnableGlobalReimbursements/index.tsx +++ b/src/pages/settings/Wallet/EnableGlobalReimbursements/index.tsx @@ -88,6 +88,7 @@ function EnableGlobalReimbursements({route}: EnableGlobalReimbursementsProps) { }, []); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (enableGlobalReimbursements?.errors || enableGlobalReimbursements?.isEnablingGlobalReimbursements || !enableGlobalReimbursements?.isSuccess) { return; } diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/ExpensifyCardVerifyAccountPage.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/ExpensifyCardVerifyAccountPage.tsx index 0a3a5528047b2..c77980c43e010 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/ExpensifyCardVerifyAccountPage.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/ExpensifyCardVerifyAccountPage.tsx @@ -44,6 +44,7 @@ function ExpensifyCardVerifyAccountPage({route}: ExpensifyCardVerifyAccountPageP // We can't store the response in Onyx for security reasons. // That is why this action is handled manually and the response is stored in a local state. // Hence eslint disable here. + // eslint-disable-next-line rulesdir/no-thenable-actions-in-views revealVirtualCardDetails(Number.parseInt(cardID, 10), validateCode) .then((value) => { setCardsDetails((prevState: Record) => ({...prevState, [cardID]: value})); diff --git a/src/pages/settings/Wallet/ReportVirtualCardFraudVerifyAccountPage.tsx b/src/pages/settings/Wallet/ReportVirtualCardFraudVerifyAccountPage.tsx index 5e1c8a9d4b2bd..5a0378ffb16c6 100644 --- a/src/pages/settings/Wallet/ReportVirtualCardFraudVerifyAccountPage.tsx +++ b/src/pages/settings/Wallet/ReportVirtualCardFraudVerifyAccountPage.tsx @@ -37,6 +37,7 @@ function ReportVirtualCardFraudVerifyAccountPage({ const prevIsLoading = usePrevious(formData?.isLoading); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (!prevIsLoading || formData?.isLoading) { return; } diff --git a/src/pages/settings/Wallet/TravelCVVPage/TravelCVVVerifyAccountPage.tsx b/src/pages/settings/Wallet/TravelCVVPage/TravelCVVVerifyAccountPage.tsx index 8441b267ad521..768a71ad9afe6 100644 --- a/src/pages/settings/Wallet/TravelCVVPage/TravelCVVVerifyAccountPage.tsx +++ b/src/pages/settings/Wallet/TravelCVVPage/TravelCVVVerifyAccountPage.tsx @@ -39,6 +39,7 @@ function TravelCVVVerifyAccountPage() { setIsLoading(true); // Call revealVirtualCardDetails and only extract CVV + // eslint-disable-next-line rulesdir/no-thenable-actions-in-views revealVirtualCardDetails(+travelCard.cardID, validateCode) .then((cardDetails) => { // Only store CVV - never persist PAN or other details diff --git a/src/pages/signin/LoginForm/BaseLoginForm.tsx b/src/pages/signin/LoginForm/BaseLoginForm.tsx index ab48c04d98cdf..41ee448f634ec 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.tsx +++ b/src/pages/signin/LoginForm/BaseLoginForm.tsx @@ -273,7 +273,7 @@ function BaseLoginForm({submitBehavior = 'submit', isVisible, ref}: BaseLoginFor )} diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.tsx b/src/pages/tasks/TaskAssigneeSelectorModal.tsx index cbae5dfd73fe8..5af569e88b12f 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.tsx +++ b/src/pages/tasks/TaskAssigneeSelectorModal.tsx @@ -1,3 +1,4 @@ +/* eslint-disable es/no-optional-chaining */ import {useRoute} from '@react-navigation/native'; import React, {useEffect} from 'react'; import {InteractionManager, View} from 'react-native'; @@ -189,6 +190,7 @@ function TaskAssigneeSelectorModal() { undefined, // passing null as report is null in this condition isCurrentUser({...option, accountID: option?.accountID ?? CONST.DEFAULT_NUMBER_ID, login: option?.login ?? undefined}, loginList, currentUserEmail), ); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { Navigation.goBack(ROUTES.NEW_TASK.getRoute(backTo)); }); diff --git a/src/pages/workspace/AccessOrNotFoundWrapper.tsx b/src/pages/workspace/AccessOrNotFoundWrapper.tsx index f2f34c5e3d100..185323a47cae5 100644 --- a/src/pages/workspace/AccessOrNotFoundWrapper.tsx +++ b/src/pages/workspace/AccessOrNotFoundWrapper.tsx @@ -197,6 +197,7 @@ function AccessOrNotFoundWrapper({ }, [pendingField, isOffline, isFeatureEnabled, shouldShowNotFoundPage, isFocused]); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (isLoadingReportData || !isPolicyNotAccessible) { return; } diff --git a/src/pages/workspace/WorkspaceOverviewPage.tsx b/src/pages/workspace/WorkspaceOverviewPage.tsx index 6e9c86764c19f..00be3f6915f64 100644 --- a/src/pages/workspace/WorkspaceOverviewPage.tsx +++ b/src/pages/workspace/WorkspaceOverviewPage.tsx @@ -701,6 +701,7 @@ function WorkspaceOverviewPage({policyDraft, policy: policyProp, route}: Workspa wrapperStyle={styles.sectionMenuItemTopDescription} onPress={onPressCurrency} hintText={ + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing hasVBA || isBankAccountVerified ? translate('workspace.editor.currencyInputDisabledText', policyCurrency) : translate('workspace.editor.currencyInputHelpText') diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index ef5cf9446288b..79b39f5a36c5e 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -687,6 +687,7 @@ function WorkspacesListPage() { shouldShowDomainsSection && !domains.length ? [{listItemType: 'domains-empty-state' as const}] : [], ].flat(); + // eslint-disable-next-line react/no-unused-prop-types const renderItem = ({item, index}: {item: WorkspaceOrDomainListItem; index: number}) => { switch (item.listItemType) { case 'workspace': { diff --git a/src/pages/workspace/accounting/AccountingContext/index.tsx b/src/pages/workspace/accounting/AccountingContext/index.tsx index a02fd0b38a0c8..c4e2c43bb29f9 100644 --- a/src/pages/workspace/accounting/AccountingContext/index.tsx +++ b/src/pages/workspace/accounting/AccountingContext/index.tsx @@ -8,10 +8,10 @@ import useLocalize from '@hooks/useLocalize'; import {removePolicyConnection} from '@libs/actions/connections'; import Navigation from '@libs/Navigation/Navigation'; import {isControlPolicy} from '@libs/PolicyUtils'; -import {getAccountingIntegrationData} from '@pages/workspace/accounting/utils'; import ROUTES from '@src/ROUTES'; import type Policy from '@src/types/onyx/Policy'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import {getAccountingIntegrationData} from '../utils'; import {defaultAccountingActionsContextValue, defaultAccountingStateContextValue, popoverAnchorRefsInitialValue} from './default'; import type {AccountingActionsContextType, AccountingStateContextType, ActiveIntegration, ActiveIntegrationState} from './types'; diff --git a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteApprovalAccountSelectPage.tsx b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteApprovalAccountSelectPage.tsx index 4e78d5f8466a7..4b5fb3848d5c4 100644 --- a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteApprovalAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteApprovalAccountSelectPage.tsx @@ -30,6 +30,7 @@ function NetSuiteApprovalAccountSelectPage({policy}: WithPolicyConnectionsProps) const netsuiteApprovalAccountOptions = useMemo( () => getNetSuiteApprovalAccountOptions(policy ?? undefined, config?.approvalAccount, translate), // The default option will be language dependent, so we need to recompute the options when the language changes + // eslint-disable-next-line react-hooks/exhaustive-deps [config?.approvalAccount, policy, translate], ); diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx index 95a841c8c633e..290697f514db1 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx @@ -52,6 +52,7 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { const config = policy?.connections?.netsuite?.options.config; const shouldGoBackToSpecificRoute = + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT || config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT; diff --git a/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx b/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx index 8377245543648..ba43317286ed0 100644 --- a/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx +++ b/src/pages/workspace/accounting/qbd/QuickBooksDesktopSetupPage.tsx @@ -40,6 +40,7 @@ function RequireQuickBooksDesktopModal({route}: RequireQuickBooksDesktopModalPro const fetchSetupLink = useCallback(() => { setHasError(false); + // eslint-disable-next-line rulesdir/no-thenable-actions-in-views getQuickbooksDesktopCodatSetupLink(policyID).then((response) => { if (!response?.jsonCode) { return; diff --git a/src/pages/workspace/categories/CategorySettingsPage.tsx b/src/pages/workspace/categories/CategorySettingsPage.tsx index a2030dca03529..8c2586947fe11 100644 --- a/src/pages/workspace/categories/CategorySettingsPage.tsx +++ b/src/pages/workspace/categories/CategorySettingsPage.tsx @@ -141,6 +141,7 @@ function CategorySettingsPage({ return ''; } return formatRequireReceiptsOverText(translate, policy, policyCategory?.maxAmountNoReceipt); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [policy, policyCategory?.maxAmountNoReceipt, translate]); const requireItemizedReceiptsOverText = useMemo(() => { diff --git a/src/pages/workspace/companyCards/addNew/PlaidConnectionStep.tsx b/src/pages/workspace/companyCards/addNew/PlaidConnectionStep.tsx index 05703b5a6a9c6..348da6f181919 100644 --- a/src/pages/workspace/companyCards/addNew/PlaidConnectionStep.tsx +++ b/src/pages/workspace/companyCards/addNew/PlaidConnectionStep.tsx @@ -180,6 +180,7 @@ function PlaidConnectionStep({feed, policyID, onExit}: {feed?: CompanyCardFeedWi } }} // User prematurely exited the Plaid flow + // eslint-disable-next-line react/jsx-props-no-multi-spaces onExit={() => { onExit?.(); handleBackButtonPress(); diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRateNameEditPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRateNameEditPage.tsx index 247191eeac423..26ef8fd1b71d2 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRateNameEditPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRateNameEditPage.tsx @@ -95,6 +95,7 @@ function PolicyDistanceRateNameEditPage({route}: PolicyDistanceRateNameEditPageP formID={ONYXKEYS.FORMS.POLICY_DISTANCE_RATE_NAME_EDIT_FORM} onSubmit={submit} submitButtonText={translate('common.save')} + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing validate={validate} style={[styles.mh5, styles.flex1]} enabledWhenOffline diff --git a/src/pages/workspace/downgrade/PayAndDowngradePage.tsx b/src/pages/workspace/downgrade/PayAndDowngradePage.tsx index 1b3e5b0dca62a..253f9e31fb119 100644 --- a/src/pages/workspace/downgrade/PayAndDowngradePage.tsx +++ b/src/pages/workspace/downgrade/PayAndDowngradePage.tsx @@ -58,6 +58,7 @@ function PayAndDowngradePage() { }, [billingDetails, translate]); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (billingDetails?.isLoading || !prevIsLoading || billingDetails?.errors) { return; } diff --git a/src/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesForm.tsx b/src/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesForm.tsx index d59f9b4360477..6d3ba10fc9807 100644 --- a/src/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesForm.tsx +++ b/src/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesForm.tsx @@ -164,6 +164,7 @@ function WorkspaceDuplicateSelectFeaturesForm({policyID}: WorkspaceDuplicateForm alternateText: allRates ? `${allRates} ${translate('workspace.common.perDiem').toLowerCase()}` : undefined, } : undefined, + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing policy?.areInvoicesEnabled && ((bankAccountList && Object.keys(bankAccountList).length) || !!invoiceCompany) ? { translation: translate('workspace.common.invoices'), diff --git a/src/pages/workspace/reports/WorkspaceReportsPage.tsx b/src/pages/workspace/reports/WorkspaceReportsPage.tsx index 528d086284ff7..4d3f4b5296951 100644 --- a/src/pages/workspace/reports/WorkspaceReportsPage.tsx +++ b/src/pages/workspace/reports/WorkspaceReportsPage.tsx @@ -58,6 +58,7 @@ function WorkspaceReportFieldsPage({ }, }: WorkspaceReportFieldsPageProps) { // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout for the small screen selection mode + // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {shouldUseNarrowLayout} = useResponsiveLayout(); const styles = useThemeStyles(); const {translate, localeCompare} = useLocalize(); diff --git a/src/pages/workspace/tags/ImportMultiLevelTagsSettingsPage.tsx b/src/pages/workspace/tags/ImportMultiLevelTagsSettingsPage.tsx index c041ff8afdb48..c46ca973c7da7 100644 --- a/src/pages/workspace/tags/ImportMultiLevelTagsSettingsPage.tsx +++ b/src/pages/workspace/tags/ImportMultiLevelTagsSettingsPage.tsx @@ -41,6 +41,7 @@ function ImportMultiLevelTagsSettingsPage({route}: ImportMultiLevelTagsSettingsP const policy = usePolicy(policyID); const backTo = route.params.backTo; // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to use the correct modal type for the decision modal + // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const hasAccountingConnections = hasAccountingConnectionsPolicyUtils(policy); const {translate} = useLocalize(); const styles = useThemeStyles(); diff --git a/src/pages/workspace/tags/types.ts b/src/pages/workspace/tags/types.ts index d70df95d1bad8..ce608d7c25b7c 100644 --- a/src/pages/workspace/tags/types.ts +++ b/src/pages/workspace/tags/types.ts @@ -36,4 +36,5 @@ type PolicyTagList = { pendingAction?: PendingAction | null; }; +// eslint-disable-next-line import/prefer-default-export export type {TagListItem, PolicyTag, PolicyTagList}; diff --git a/src/pages/workspace/upgrade/UpgradeIntro.tsx b/src/pages/workspace/upgrade/UpgradeIntro.tsx index 0c7ac244c2917..fd4f60664ab13 100644 --- a/src/pages/workspace/upgrade/UpgradeIntro.tsx +++ b/src/pages/workspace/upgrade/UpgradeIntro.tsx @@ -50,6 +50,7 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const shouldUseTeamPricing = isCategorizing || isDistanceRateUpgrade || isReporting; return `${convertToShortDisplayString( + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing CONST.SUBSCRIPTION_PRICES[upgradeCurrency][shouldUseTeamPricing ? CONST.POLICY.TYPE.TEAM : CONST.POLICY.TYPE.CORPORATE][CONST.SUBSCRIPTION.TYPE.ANNUAL], upgradeCurrency, )} `; diff --git a/src/pages/workspace/withPolicy.tsx b/src/pages/workspace/withPolicy.tsx index 1449654c0901d..b343d78b446e5 100644 --- a/src/pages/workspace/withPolicy.tsx +++ b/src/pages/workspace/withPolicy.tsx @@ -87,6 +87,7 @@ export default function (WrappedComponent: Compo const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP); const [policy, policyResults] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`); const [policyDraft, policyDraftResults] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${policyID}`); + /* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */ const isLoadingPolicy = !hasLoadedApp || isLoadingOnyxValue(policyResults, policyDraftResults); if (policyID && policyID.length > 0) { diff --git a/src/stories/AvatarSelector.stories.tsx b/src/stories/AvatarSelector.stories.tsx index c93294ce6c036..cb231cb63854e 100644 --- a/src/stories/AvatarSelector.stories.tsx +++ b/src/stories/AvatarSelector.stories.tsx @@ -21,6 +21,7 @@ const story: Meta = { function Template(props: AvatarSelectorProps) { const [selected, setSelected] = useState(props.selectedID); + // eslint-disable-next-line react/jsx-props-no-spreading return ( = { }; function Template(props: ButtonProps) { + // eslint-disable-next-line react/jsx-props-no-spreading return