Skip to content

Commit 4f3a2ee

Browse files
authored
Merge pull request #56666 from ZhenjaHorbach/updated-naming-convention-rule-for-using-private-prefixes
[No QA] Update private_ prefix lint rule for variable naming
2 parents 1627ebf + ccc63f7 commit 4f3a2ee

File tree

8 files changed

+7
-11
lines changed

8 files changed

+7
-11
lines changed

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,14 @@ module.exports = {
150150
{
151151
selector: ['variable', 'property'],
152152
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
153+
// This filter excludes variables and properties that start with "private_" to make them valid.
154+
//
155+
// Examples:
156+
// - "private_a" → valid
157+
// - "private_test" → valid
158+
// - "private_" → not valid
153159
filter: {
154-
regex: '^private_[a-z][a-zA-Z0-9]+$',
160+
regex: '^private_[a-z][a-zA-Z0-9]*$',
155161
match: false,
156162
},
157163
},

src/libs/OptionsListUtils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,6 @@ function createOption(
792792
if (report) {
793793
result.isChatRoom = reportUtilsIsChatRoom(report);
794794
result.isDefaultRoom = isDefaultRoom(report);
795-
// eslint-disable-next-line @typescript-eslint/naming-convention
796795
result.private_isArchived = getReportNameValuePairs(report.reportID)?.private_isArchived;
797796
result.isExpenseReport = isExpenseReport(report);
798797
result.isInvoiceRoom = isInvoiceRoom(report);

src/libs/actions/Policy/Policy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ function deleteWorkspace(policyID: string, policyName: string) {
425425
onyxMethod: Onyx.METHOD.MERGE,
426426
key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${reportID}`,
427427
value: {
428-
// eslint-disable-next-line @typescript-eslint/naming-convention
429428
private_isArchived: null,
430429
},
431430
});

src/libs/migrations/NVPMigration.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ const migrations = {
1212
preferredLocale: ONYXKEYS.NVP_PREFERRED_LOCALE,
1313
preferredEmojiSkinTone: ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE,
1414
frequentlyUsedEmojis: ONYXKEYS.FREQUENTLY_USED_EMOJIS,
15-
// eslint-disable-next-line @typescript-eslint/naming-convention
1615
private_blockedFromConcierge: ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE,
17-
// eslint-disable-next-line @typescript-eslint/naming-convention
1816
private_pushNotificationID: ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID,
1917
tryFocusMode: ONYXKEYS.NVP_TRY_FOCUS_MODE,
2018
introSelected: ONYXKEYS.NVP_INTRO_SELECTED,

tests/unit/DebugUtilsTest.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,6 @@ describe('DebugUtils', () => {
786786
});
787787
it('returns correct reason when report is archived', async () => {
788788
const reportNameValuePairs = {
789-
// eslint-disable-next-line @typescript-eslint/naming-convention
790789
private_isArchived: DateUtils.getDBTime(),
791790
};
792791
await Onyx.set(ONYXKEYS.NVP_PRIORITY_MODE, CONST.PRIORITY_MODE.DEFAULT);

tests/unit/OptionsListUtilsTest.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,6 @@ describe('OptionsListUtils', () => {
479479
};
480480

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

tests/unit/SidebarOrderTest.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,6 @@ describe('Sidebar', () => {
858858

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

10131012
const reportNameValuePairsCollectionDataSet: ReportNameValuePairsCollectionDataSet = {
10141013
[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report1.reportID}`]: {
1015-
// eslint-disable-next-line @typescript-eslint/naming-convention
10161014
private_isArchived: DateUtils.getDBTime(),
10171015
},
10181016
};

tests/unit/SidebarTest.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ describe('Sidebar', () => {
5757
};
5858

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

@@ -120,7 +119,6 @@ describe('Sidebar', () => {
120119
},
121120
};
122121
const reportNameValuePairs = {
123-
// eslint-disable-next-line @typescript-eslint/naming-convention
124122
private_isArchived: DateUtils.getDBTime(),
125123
};
126124

0 commit comments

Comments
 (0)