Skip to content

Commit

Permalink
Merge pull request Expensify#56666 from ZhenjaHorbach/updated-naming-…
Browse files Browse the repository at this point in the history
…convention-rule-for-using-private-prefixes

[No QA] Update private_ prefix lint rule for variable naming
  • Loading branch information
srikarparsi authored Feb 13, 2025
2 parents 1627ebf + ccc63f7 commit 4f3a2ee
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 11 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,14 @@ module.exports = {
{
selector: ['variable', 'property'],
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
// This filter excludes variables and properties that start with "private_" to make them valid.
//
// Examples:
// - "private_a" → valid
// - "private_test" → valid
// - "private_" → not valid
filter: {
regex: '^private_[a-z][a-zA-Z0-9]+$',
regex: '^private_[a-z][a-zA-Z0-9]*$',
match: false,
},
},
Expand Down
1 change: 0 additions & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,6 @@ function createOption(
if (report) {
result.isChatRoom = reportUtilsIsChatRoom(report);
result.isDefaultRoom = isDefaultRoom(report);
// eslint-disable-next-line @typescript-eslint/naming-convention
result.private_isArchived = getReportNameValuePairs(report.reportID)?.private_isArchived;
result.isExpenseReport = isExpenseReport(report);
result.isInvoiceRoom = isInvoiceRoom(report);
Expand Down
1 change: 0 additions & 1 deletion src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ function deleteWorkspace(policyID: string, policyName: string) {
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${reportID}`,
value: {
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: null,
},
});
Expand Down
2 changes: 0 additions & 2 deletions src/libs/migrations/NVPMigration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const migrations = {
preferredLocale: ONYXKEYS.NVP_PREFERRED_LOCALE,
preferredEmojiSkinTone: ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE,
frequentlyUsedEmojis: ONYXKEYS.FREQUENTLY_USED_EMOJIS,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_blockedFromConcierge: ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE,
// eslint-disable-next-line @typescript-eslint/naming-convention
private_pushNotificationID: ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID,
tryFocusMode: ONYXKEYS.NVP_TRY_FOCUS_MODE,
introSelected: ONYXKEYS.NVP_INTRO_SELECTED,
Expand Down
1 change: 0 additions & 1 deletion tests/unit/DebugUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,6 @@ describe('DebugUtils', () => {
});
it('returns correct reason when report is archived', async () => {
const reportNameValuePairs = {
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};
await Onyx.set(ONYXKEYS.NVP_PRIORITY_MODE, CONST.PRIORITY_MODE.DEFAULT);
Expand Down
1 change: 0 additions & 1 deletion tests/unit/OptionsListUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ describe('OptionsListUtils', () => {
};

const reportNameValuePairs = {
// 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 @@ -858,7 +858,6 @@ describe('Sidebar', () => {

const reportNameValuePairsCollectionDataSet: ReportNameValuePairsCollectionDataSet = {
[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report1.reportID}`]: {
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
},
};
Expand Down Expand Up @@ -1012,7 +1011,6 @@ describe('Sidebar', () => {

const reportNameValuePairsCollectionDataSet: ReportNameValuePairsCollectionDataSet = {
[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report1.reportID}`]: {
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
},
};
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/SidebarTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('Sidebar', () => {
};

const reportNameValuePairs = {
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};

Expand Down Expand Up @@ -120,7 +119,6 @@ describe('Sidebar', () => {
},
};
const reportNameValuePairs = {
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: DateUtils.getDBTime(),
};

Expand Down

0 comments on commit 4f3a2ee

Please sign in to comment.