From fd975696030b523abaa41cca00579ed4aba648bb Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Thu, 26 Sep 2024 11:17:43 +0100 Subject: [PATCH 1/6] eslint deprecation/deprecation --- .eslintrc.js | 5 ++++- src/libs/ReportActionsUtils.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index d9e25cc596f..9f0668f4ac4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -108,7 +108,7 @@ module.exports = { 'plugin:you-dont-need-lodash-underscore/all', 'plugin:prettier/recommended', ], - plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library', 'eslint-plugin-react-compiler', 'lodash'], + plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library', 'eslint-plugin-react-compiler', 'lodash', 'deprecation'], ignorePatterns: ['lib/**'], parser: '@typescript-eslint/parser', parserOptions: { @@ -178,6 +178,9 @@ module.exports = { 'es/no-nullish-coalescing-operators': 'off', 'es/no-optional-chaining': 'off', + // Deprecation rules + // 'deprecation/deprecation': 'off', + // Import specific rules 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], 'import/no-extraneous-dependencies': 'off', diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 61fe8387cce..4257214436c 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -214,6 +214,7 @@ function isActionOfType( } function getOriginalMessage(reportAction: OnyxInputOrEntry>): OriginalMessage | undefined { + // Test if (!Array.isArray(reportAction?.message)) { return reportAction?.message ?? reportAction?.originalMessage; } From 39cb8085f8b917a2f6103f2d629ec417336e4a1d Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Thu, 26 Sep 2024 11:22:17 +0100 Subject: [PATCH 2/6] Update .eslintrc.changed.js instead --- .eslintrc.changed.js | 2 +- .eslintrc.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.eslintrc.changed.js b/.eslintrc.changed.js index c279c3e67a5..61dc8bb153a 100644 --- a/.eslintrc.changed.js +++ b/.eslintrc.changed.js @@ -5,6 +5,6 @@ module.exports = { project: './tsconfig.json', }, rules: { - 'deprecation/deprecation': 'error', + 'deprecation/deprecation': 'off', }, }; diff --git a/.eslintrc.js b/.eslintrc.js index 9f0668f4ac4..d9e25cc596f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -108,7 +108,7 @@ module.exports = { 'plugin:you-dont-need-lodash-underscore/all', 'plugin:prettier/recommended', ], - plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library', 'eslint-plugin-react-compiler', 'lodash', 'deprecation'], + plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library', 'eslint-plugin-react-compiler', 'lodash'], ignorePatterns: ['lib/**'], parser: '@typescript-eslint/parser', parserOptions: { @@ -178,9 +178,6 @@ module.exports = { 'es/no-nullish-coalescing-operators': 'off', 'es/no-optional-chaining': 'off', - // Deprecation rules - // 'deprecation/deprecation': 'off', - // Import specific rules 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], 'import/no-extraneous-dependencies': 'off', From 787d3821c9d76c28b1122d132701e7e701dc49fb Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Thu, 26 Sep 2024 11:26:48 +0100 Subject: [PATCH 3/6] Add to main config --- .eslintrc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index d9e25cc596f..716e6e2503c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -108,7 +108,7 @@ module.exports = { 'plugin:you-dont-need-lodash-underscore/all', 'plugin:prettier/recommended', ], - plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library', 'eslint-plugin-react-compiler', 'lodash'], + plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library', 'eslint-plugin-react-compiler', 'lodash', 'deprecation'] ignorePatterns: ['lib/**'], parser: '@typescript-eslint/parser', parserOptions: { @@ -177,6 +177,7 @@ module.exports = { // ESLint core rules 'es/no-nullish-coalescing-operators': 'off', 'es/no-optional-chaining': 'off', + 'deprecation/deprecation': 'off', // Import specific rules 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], From 649404acfe8b00aabbeca271853128ab51063310 Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Thu, 26 Sep 2024 11:29:22 +0100 Subject: [PATCH 4/6] Turn deprecation check off in main file --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 716e6e2503c..761a62b8314 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -108,7 +108,7 @@ module.exports = { 'plugin:you-dont-need-lodash-underscore/all', 'plugin:prettier/recommended', ], - plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library', 'eslint-plugin-react-compiler', 'lodash', 'deprecation'] + plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library', 'eslint-plugin-react-compiler', 'lodash', 'deprecation'], ignorePatterns: ['lib/**'], parser: '@typescript-eslint/parser', parserOptions: { From 807c0c8fc50c976832ed8b6d3bda12d0ef78d995 Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Thu, 26 Sep 2024 11:38:34 +0100 Subject: [PATCH 5/6] Ignore deprecation errors in helper functions --- .eslintrc.changed.js | 2 +- .eslintrc.js | 2 +- src/libs/ReportActionsUtils.ts | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.eslintrc.changed.js b/.eslintrc.changed.js index 61dc8bb153a..c279c3e67a5 100644 --- a/.eslintrc.changed.js +++ b/.eslintrc.changed.js @@ -5,6 +5,6 @@ module.exports = { project: './tsconfig.json', }, rules: { - 'deprecation/deprecation': 'off', + 'deprecation/deprecation': 'error', }, }; diff --git a/.eslintrc.js b/.eslintrc.js index 761a62b8314..48dedf7188f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -177,7 +177,7 @@ module.exports = { // ESLint core rules 'es/no-nullish-coalescing-operators': 'off', 'es/no-optional-chaining': 'off', - 'deprecation/deprecation': 'off', + 'deprecation/deprecation': 'error', // Import specific rules 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 4257214436c..4edc401f6d4 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -214,10 +214,11 @@ function isActionOfType( } function getOriginalMessage(reportAction: OnyxInputOrEntry>): OriginalMessage | undefined { - // Test if (!Array.isArray(reportAction?.message)) { + // eslint-disable-next-line deprecation/deprecation return reportAction?.message ?? reportAction?.originalMessage; } + // eslint-disable-next-line deprecation/deprecation return reportAction.originalMessage; } @@ -594,6 +595,7 @@ function isReportActionDeprecated(reportAction: OnyxEntry, key: st // HACK ALERT: We're temporarily filtering out any reportActions keyed by sequenceNumber // to prevent bugs during the migration from sequenceNumber -> reportActionID + // eslint-disable-next-line deprecation/deprecation if (String(reportAction.sequenceNumber) === key) { Log.info('Front-end filtered out reportAction keyed by sequenceNumber!', false, reportAction); return true; @@ -1785,6 +1787,7 @@ export { getNumberOfMoneyRequests, getOneTransactionThreadReportID, getOriginalMessage, + // eslint-disable-next-line deprecation/deprecation getParentReportAction, getRemovedFromApprovalChainMessage, getReportAction, From 69f2bb131ecbb6cf34355eda4ceab5e68e7d0787 Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Thu, 26 Sep 2024 11:40:19 +0100 Subject: [PATCH 6/6] turn off deprecation/deprecation for the main eslint config --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 48dedf7188f..761a62b8314 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -177,7 +177,7 @@ module.exports = { // ESLint core rules 'es/no-nullish-coalescing-operators': 'off', 'es/no-optional-chaining': 'off', - 'deprecation/deprecation': 'error', + 'deprecation/deprecation': 'off', // Import specific rules 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],