Skip to content

Commit 8463088

Browse files
authored
Merge pull request Expensify#66031 from callstack-internal/VickyStash/refactor/65022-bumb-eslint-config-version
[No QA] Add `no-unstable-hook-defaults` rule
2 parents 39c69a4 + 0e4bebf commit 8463088

8 files changed

Lines changed: 17 additions & 15 deletions

File tree

.eslintrc.changed.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
'deprecation/deprecation': 'error',
99
'rulesdir/no-default-id-values': 'error',
1010
'rulesdir/provide-canBeMissing-in-useOnyx': 'error',
11+
'rulesdir/no-unstable-hook-defaults': 'error',
1112
'no-restricted-syntax': [
1213
'error',
1314
{

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
"electron-builder": "25.0.0",
307307
"eslint": "^8.57.0",
308308
"eslint-config-airbnb-typescript": "^18.0.0",
309-
"eslint-config-expensify": "2.0.84",
309+
"eslint-config-expensify": "2.0.86",
310310
"eslint-config-prettier": "^9.1.0",
311311
"eslint-plugin-deprecation": "^3.0.0",
312312
"eslint-plugin-jest": "^28.6.0",

src/CONST/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6508,6 +6508,7 @@ const CONST = {
65086508
mapping: 'report-fields-mapping',
65096509
},
65106510
},
6511+
DEFAULT_REPORT_METADATA: {isLoadingInitialReportActions: true},
65116512
get UPGRADE_FEATURE_INTRO_MAPPING() {
65126513
return {
65136514
reportFields: {

src/pages/Search/SearchAdvancedFiltersPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {clearAdvancedFilters} from '@libs/actions/Search';
99
import CONST from '@src/CONST';
1010
import ONYXKEYS from '@src/ONYXKEYS';
1111
import type {SearchAdvancedFiltersForm} from '@src/types/form';
12+
import {getEmptyObject} from '@src/types/utils/EmptyObject';
1213
import AdvancedSearchFilters from './AdvancedSearchFilters';
1314

1415
function SearchAdvancedFiltersPage() {
1516
const styles = useThemeStyles();
1617
const {translate} = useLocalize();
1718

18-
const emptySearchFilters: SearchAdvancedFiltersForm = {} as SearchAdvancedFiltersForm;
19-
const [searchAdvancedFilters = emptySearchFilters] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
19+
const [searchAdvancedFilters = getEmptyObject<SearchAdvancedFiltersForm>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
2020

2121
const shouldShowResetFilters = Object.entries(searchAdvancedFilters)
2222
.filter(([key, value]) => {

src/pages/TransactionReceiptPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function TransactionReceipt({route}: TransactionReceiptProps) {
2525
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true});
2626
const [transactionMain] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: true});
2727
const [transactionDraft] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {canBeMissing: true});
28-
const [reportMetadata = {isLoadingInitialReportActions: true}] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {canBeMissing: true});
28+
const [reportMetadata = CONST.DEFAULT_REPORT_METADATA] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {canBeMissing: true});
2929

3030
const isDraftTransaction = !!action;
3131
const transaction = isDraftTransaction ? transactionDraft : transactionMain;

src/pages/home/report/ReportActionItemMessageEdit.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ const shouldUseForcedSelectionRange = shouldUseEmojiPickerSelection();
8181
// video source -> video attributes
8282
const draftMessageVideoAttributeCache = new Map<string, string>();
8383

84+
const DEFAULT_MODAL_VALUE = {
85+
willAlertModalBecomeVisible: false,
86+
isVisible: false,
87+
};
88+
8489
function ReportActionItemMessageEdit(
8590
{action, draftMessage, reportID, policyID, index, isGroupPolicyReport, shouldDisableEmojiPicker = false}: ReportActionItemMessageEditProps,
8691
forwardedRef: ForwardedRef<TextInput | HTMLTextAreaElement | undefined>,
@@ -111,12 +116,7 @@ function ReportActionItemMessageEdit(
111116
const {hasExceededMaxCommentLength, validateCommentMaxLength} = useHandleExceedMaxCommentLength();
112117
const debouncedValidateCommentMaxLength = useMemo(() => lodashDebounce(validateCommentMaxLength, CONST.TIMING.COMMENT_LENGTH_DEBOUNCE_TIME), [validateCommentMaxLength]);
113118

114-
const [
115-
modal = {
116-
willAlertModalBecomeVisible: false,
117-
isVisible: false,
118-
},
119-
] = useOnyx(ONYXKEYS.MODAL, {canBeMissing: true});
119+
const [modal = DEFAULT_MODAL_VALUE] = useOnyx(ONYXKEYS.MODAL, {canBeMissing: true});
120120
const [onyxInputFocused = false] = useOnyx(ONYXKEYS.INPUT_FOCUSED, {canBeMissing: true});
121121

122122
const textInputRef = useRef<(HTMLTextAreaElement & TextInput) | null>(null);

src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre
2121
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true});
2222
const [transactionMain] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: true});
2323
const [transactionDraft] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {canBeMissing: true});
24-
const [reportMetadata = {isLoadingInitialReportActions: true}] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {canBeMissing: true});
24+
const [reportMetadata = CONST.DEFAULT_REPORT_METADATA] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {canBeMissing: true});
2525

2626
const isDraftTransaction = !!iouAction;
2727
const transaction = isDraftTransaction ? transactionDraft : transactionMain;

0 commit comments

Comments
 (0)