Skip to content

Commit

Permalink
Merge pull request #54937 from nkdengineer/fix/54822
Browse files Browse the repository at this point in the history
[No QA] fix: Allow private_ prefix lint rule for variable naming
  • Loading branch information
srikarparsi authored Jan 22, 2025
2 parents 0190b0a + 0738ac7 commit 73f2714
Show file tree
Hide file tree
Showing 18 changed files with 4 additions and 25 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ module.exports = {
{
selector: ['variable', 'property'],
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
filter: {
regex: '^private_[a-z][a-zA-Z0-9]+$',
match: false,
},
},
{
selector: 'function',
Expand Down
1 change: 0 additions & 1 deletion src/libs/DebugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ function validateReportDraftProperty(key: keyof Report, value: string) {
fieldList: CONST.RED_BRICK_ROAD_PENDING_ACTION,
permissions: CONST.RED_BRICK_ROAD_PENDING_ACTION,
tripData: CONST.RED_BRICK_ROAD_PENDING_ACTION,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: CONST.RED_BRICK_ROAD_PENDING_ACTION,
addWorkspaceRoom: CONST.RED_BRICK_ROAD_PENDING_ACTION,
avatar: CONST.RED_BRICK_ROAD_PENDING_ACTION,
Expand Down
2 changes: 0 additions & 2 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ function getOptionData({
hasParentAccess: undefined,
isIOUReportOwner: null,
isChatRoom: false,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: undefined,
shouldShowSubscript: false,
isPolicyExpenseChat: false,
Expand All @@ -364,7 +363,6 @@ function getOptionData({
result.isTaskReport = ReportUtils.isTaskReport(report);
result.isInvoiceReport = ReportUtils.isInvoiceReport(report);
result.parentReportAction = parentReportAction;
// eslint-disable-next-line @typescript-eslint/naming-convention
result.private_isArchived = report?.private_isArchived;
result.isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
result.isExpenseRequest = ReportUtils.isExpenseRequest(report);
Expand Down
2 changes: 0 additions & 2 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ function deleteWorkspace(policyID: string, policyName: string) {
oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name,
policyName: '',
}),
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: currentTime,
},
});
Expand Down Expand Up @@ -413,7 +412,6 @@ function deleteWorkspace(policyID: string, policyName: string) {
statusNum,
oldPolicyName,
policyName: report?.policyName,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: null,
},
});
Expand Down
1 change: 0 additions & 1 deletion src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
visibility: reportOnyx.visibility,
oldPolicyName: reportOnyx.oldPolicyName,
policyName: reportOnyx.policyName,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: reportOnyx.private_isArchived,
lastMentionedTime: reportOnyx.lastMentionedTime,
avatarUrl: reportOnyx.avatarUrl,
Expand Down
1 change: 0 additions & 1 deletion src/types/form/DebugReportForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const INPUT_IDS = {
POLICY_ID: 'policyID',
POLICY_NAME: 'policyName',
PRIVATE_NOTES: 'privateNotes',
// eslint-disable-next-line @typescript-eslint/naming-convention
PRIVATE_IS_ARCHIVED: 'private_isArchived',
REPORT_ID: 'reportID',
REPORT_NAME: 'reportName',
Expand Down
1 change: 0 additions & 1 deletion src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback<
};

/** Whether the report is archived */
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived?: string;

/** The report's welcome message */
Expand Down
1 change: 0 additions & 1 deletion src/types/onyx/ReportNameValuePairs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type * as OnyxCommon from './OnyxCommon';
/** Model of additional report details */
type ReportNameValuePairs = OnyxCommon.OnyxValueWithOfflineFeedback<{
/** Whether the report is an archived room */
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: boolean;
}>;

Expand Down
1 change: 0 additions & 1 deletion src/types/onyx/SearchResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ type SearchReport = {
unheldTotal?: number;

/** Whether the report is archived */
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived?: string;

/** Whether the action is loading */
Expand Down
1 change: 0 additions & 1 deletion src/types/utils/whitelistedReportKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type WhitelistedReport = OnyxCommon.OnyxValueWithOfflineFeedback<
endDate: unknown;
tripID: unknown;
};
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: unknown;
welcomeMessage: unknown;
},
Expand Down
1 change: 0 additions & 1 deletion tests/data/Invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ const convertedInvoiceChat: OnyxTypes.Report = {
policyAvatar: '',
policyID: 'CC048FA711B35B1F',
policyName: "53019's Workspace",
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: '',
reportID: '7605647250932303',
reportName: 'Chat Report',
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/LHNItemsPresence.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,10 @@ describe('SidebarLinksData', () => {
LHNTestUtils.getDefaultRenderedSidebarLinks();
const archivedReport: Report = {
...createReport(false),
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};
const reportNameValuePairs = {
type: 'chat',
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: true,
};

Expand Down
2 changes: 0 additions & 2 deletions tests/unit/DebugUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,6 @@ describe('DebugUtils', () => {
await Onyx.set(ONYXKEYS.NVP_PRIORITY_MODE, CONST.PRIORITY_MODE.DEFAULT);
const reason = DebugUtils.getReasonForShowingRowInLHN({
...baseReport,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: 'true',
});
expect(reason).toBe('debug.reasonVisibleInLHN.isArchived');
Expand Down Expand Up @@ -1061,7 +1060,6 @@ describe('DebugUtils', () => {
await Onyx.multiSet({
...MOCK_REPORTS,
[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}2` as const]: {
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: false,
},
[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1` as const]: MOCK_REPORT_ACTIONS,
Expand Down
1 change: 0 additions & 1 deletion tests/unit/OptionsListUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ describe('OptionsListUtils', () => {
// This indicates that the report is archived
stateNum: 2,
statusNum: 2,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
},
};
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/ReportUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ describe('ReportUtils', () => {
...baseAdminsRoom,
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};

Expand All @@ -367,7 +366,6 @@ describe('ReportUtils', () => {
...baseUserCreatedRoom,
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};

Expand Down Expand Up @@ -413,7 +411,6 @@ describe('ReportUtils', () => {
oldPolicyName: policy.name,
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};

Expand Down
2 changes: 0 additions & 2 deletions tests/unit/SidebarOrderTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,6 @@ describe('Sidebar', () => {
chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM,
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};
const report2 = LHNTestUtils.getFakeReport([1, 3]);
Expand Down Expand Up @@ -984,7 +983,6 @@ describe('Sidebar', () => {
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
lastMessageText: 'test',
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};
const report2 = {
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/SidebarTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe('Sidebar', () => {
chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM,
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
lastMessageText: 'test',
};
Expand Down Expand Up @@ -102,7 +101,6 @@ describe('Sidebar', () => {
chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM,
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
lastMessageText: 'test',
};
Expand Down
1 change: 0 additions & 1 deletion tests/utils/collections/optionData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default function createRandomOptionData(index: number): OptionData {
policyName: randWord(),
policyID: `policy_${index}`,
accountID: randNumber(),
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: new Date().toISOString(),
isPolicyExpenseChat: randBoolean(),
chatType: rand(Object.values(CONST.REPORT.CHAT_TYPE)),
Expand Down

0 comments on commit 73f2714

Please sign in to comment.