Skip to content

Commit 594979a

Browse files
committed
PR fixes and formating
1 parent 9a9ae63 commit 594979a

File tree

7 files changed

+85
-71
lines changed

7 files changed

+85
-71
lines changed

package-lock.json

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

packages/contentstack-audit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"prepack": "npm run build && oclif manifest && oclif readme",
7777
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
7878
"version": "oclif readme && git add README.md",
79-
"clean": "rm -rf ./lib tsconfig.tsbuildinfo oclif.manifest.json",
79+
"clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinf o oclif.manifest.json",
8080
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
8181
},
8282
"engines": {

packages/contentstack-audit/src/audit-base-command.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
416416
moduleName: keyof typeof config.moduleConfig | keyof typeof config.ReportTitleForEntries,
417417
listOfMissingRefs: Record<string, any>,
418418
): Promise<void> {
419-
if(Object.keys(config.moduleConfig).includes(moduleName)){
419+
if (Object.keys(config.moduleConfig).includes(moduleName)) {
420420
const csvPath = join(sanitizePath(this.sharedConfig.reportPath), `${sanitizePath(moduleName)}.csv`);
421421
return new Promise<void>((resolve, reject) => {
422422
// file deepcode ignore MissingClose: Will auto close once csv stream end
@@ -428,7 +428,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
428428
const columns: (keyof typeof OutputColumn)[] = userDefinedColumns
429429
? [...userDefinedColumns, ...defaultColumns.filter((val: string) => !userDefinedColumns.includes(val))]
430430
: defaultColumns;
431-
431+
432432
if (this.sharedConfig.flags.filter) {
433433
const [column, value]: [keyof typeof OutputColumn, string] = this.sharedConfig.flags.filter.split('=');
434434
// Filter the missingRefs array
@@ -440,29 +440,29 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
440440
return false;
441441
});
442442
}
443-
443+
444444
const rowData: Record<string, string | string[]>[] = [];
445445
for (const issue of missingRefs) {
446446
let row: Record<string, string | string[]> = {};
447-
447+
448448
for (const column of columns) {
449449
if (Object.keys(issue).includes(OutputColumn[column])) {
450450
const issueKey = OutputColumn[column] as keyof typeof issue;
451451
row[column] = issue[issueKey] as string;
452452
row[column] = typeof row[column] === 'object' ? JSON.stringify(row[column]) : row[column];
453453
}
454454
}
455-
455+
456456
if (this.currentCommand === 'cm:stacks:audit:fix') {
457457
row['Fix status'] = row.fixStatus;
458458
}
459-
459+
460460
rowData.push(row);
461461
}
462462
csv.write(rowData, { headers: true }).pipe(ws).on('error', reject).on('finish', resolve);
463463
});
464464
} else {
465-
return new Promise<void>((reject)=>{
465+
return new Promise<void>((reject) => {
466466
return reject()
467467
})
468468
}

packages/contentstack-audit/src/messages/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ function $t(msg: string, args: Record<string, string>): string {
8282
if (status === 'safe') {
8383
const sanitizedValue = args[key] ? escapeRegExp(args[key]) : '';
8484
msg = msg.replace(escapedKeyRegex, sanitizedValue || escapedKey);
85-
} else {
86-
8785
}
8886
}
8987

packages/contentstack-audit/src/modules/content-types.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ export default class ContentType {
5151
this.fix = fix ?? false;
5252
this.ctSchema = ctSchema;
5353
this.gfSchema = gfSchema;
54-
this.moduleName = this.validateModules(moduleName!,this.config.moduleConfig);
54+
this.moduleName = this.validateModules(moduleName!, this.config.moduleConfig);
5555
this.fileName = config.moduleConfig[this.moduleName].fileName;
5656
this.folderPath = resolve(sanitizePath(config.basePath), sanitizePath(config.moduleConfig[this.moduleName].dirName));
5757
}
5858

59-
validateModules(moduleName:keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>):keyof typeof auditConfig.moduleConfig {
60-
if(Object.keys(moduleConfig).includes(moduleName)){
59+
validateModules(moduleName: keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>): keyof typeof auditConfig.moduleConfig {
60+
if (Object.keys(moduleConfig).includes(moduleName)) {
6161
return moduleName;
62-
}
62+
}
6363
return 'content-types'
6464
}
6565
/**
@@ -121,7 +121,7 @@ export default class ContentType {
121121
if (existsSync(extensionPath)) {
122122
try {
123123
this.extensions = Object.keys(JSON.parse(readFileSync(extensionPath, 'utf8')));
124-
} catch (error) {}
124+
} catch (error) { }
125125
}
126126

127127
if (existsSync(marketplacePath)) {
@@ -134,7 +134,7 @@ export default class ContentType {
134134
) as string[];
135135
this.extensions.push(...metaData);
136136
}
137-
} catch (error) {}
137+
} catch (error) { }
138138
}
139139
}
140140

@@ -189,8 +189,8 @@ export default class ContentType {
189189
...this.validateReferenceField(
190190
[...tree, { uid: field.uid, name: child.display_name }],
191191
child as ReferenceFieldDataType,
192-
),
193-
);
192+
),
193+
);
194194
break;
195195
case 'global_field':
196196
await this.validateGlobalField(
@@ -270,19 +270,19 @@ export default class ContentType {
270270

271271
return missingRefs.length
272272
? [
273-
{
274-
tree,
275-
data_type,
276-
missingRefs,
277-
display_name,
278-
ct_uid: this.currentUid,
279-
name: this.currentTitle,
280-
treeStr: tree
281-
.map(({ name }) => name)
282-
.filter((val) => val)
283-
.join(' ➜ '),
284-
},
285-
]
273+
{
274+
tree,
275+
data_type,
276+
missingRefs,
277+
display_name,
278+
ct_uid: this.currentUid,
279+
name: this.currentTitle,
280+
treeStr: tree
281+
.map(({ name }) => name)
282+
.filter((val) => val)
283+
.join(' ➜ '),
284+
},
285+
]
286286
: [];
287287
}
288288

@@ -398,19 +398,19 @@ export default class ContentType {
398398

399399
return missingRefs.length
400400
? [
401-
{
402-
tree,
403-
data_type,
404-
missingRefs,
405-
display_name,
406-
ct_uid: this.currentUid,
407-
name: this.currentTitle,
408-
treeStr: tree
409-
.map(({ name }) => name)
410-
.filter((val) => val)
411-
.join(' ➜ '),
412-
},
413-
]
401+
{
402+
tree,
403+
data_type,
404+
missingRefs,
405+
display_name,
406+
ct_uid: this.currentUid,
407+
name: this.currentTitle,
408+
treeStr: tree
409+
.map(({ name }) => name)
410+
.filter((val) => val)
411+
.join(' ➜ '),
412+
},
413+
]
414414
: [];
415415
}
416416

packages/contentstack-audit/src/modules/extensions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ export default class Extensions {
3434
this.fix = fix ?? false;
3535
this.ctSchema = ctSchema;
3636
this.extensionsSchema = [];
37-
this.moduleName = this.validateModules(moduleName!,this.config.moduleConfig);
37+
this.moduleName = this.validateModules(moduleName!, this.config.moduleConfig);
3838
this.fileName = config.moduleConfig[this.moduleName].fileName;
3939
this.folderPath = resolve(sanitizePath(config.basePath), sanitizePath(config.moduleConfig[this.moduleName].dirName));
4040
this.ctUidSet = new Set(['$all']);
4141
this.missingCtInExtensions = [];
4242
this.missingCts = new Set();
4343
this.extensionsPath = '';
4444
}
45-
validateModules(moduleName:keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>):keyof typeof auditConfig.moduleConfig {
46-
if(Object.keys(moduleConfig).includes(moduleName)){
45+
validateModules(moduleName: keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>): keyof typeof auditConfig.moduleConfig {
46+
if (Object.keys(moduleConfig).includes(moduleName)) {
4747
return moduleName;
48-
}
48+
}
4949
return 'extensions'
5050
}
5151

packages/contentstack-audit/src/modules/workflows.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default class Workflows {
3535
this.fix = fix ?? false;
3636
this.ctSchema = ctSchema;
3737
this.workflowSchema = [];
38-
this.moduleName = this.validateModules(moduleName!,this.config.moduleConfig);
38+
this.moduleName = this.validateModules(moduleName!, this.config.moduleConfig);
3939
this.fileName = config.moduleConfig[this.moduleName].fileName;
4040
this.folderPath = resolve(sanitizePath(config.basePath), sanitizePath(config.moduleConfig[this.moduleName].dirName));
4141
this.ctUidSet = new Set(['$all']);
@@ -44,10 +44,10 @@ export default class Workflows {
4444
this.workflowPath = '';
4545
this.isBranchFixDone = false;
4646
}
47-
validateModules(moduleName:keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>):keyof typeof auditConfig.moduleConfig {
48-
if(Object.keys(moduleConfig).includes(moduleName)){
47+
validateModules(moduleName: keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>): keyof typeof auditConfig.moduleConfig {
48+
if (Object.keys(moduleConfig).includes(moduleName)) {
4949
return moduleName;
50-
}
50+
}
5151
return 'workflows'
5252
}
5353

0 commit comments

Comments
 (0)