Skip to content

Commit fdb9683

Browse files
committed
Used CLI Table Dependency to display Table Output
Fixed ESLint Error in Output Util Function
1 parent 273e64a commit fdb9683

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/utils/output.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as jsonexport from 'jsonexport'
2+
import * as Table from 'cli-table3'
23
import * as path from 'path'
34
import * as fs from 'fs'
45
const regexMessages = require('../../messages/index.json').validateRegex
@@ -20,7 +21,13 @@ export default async function generateOutput(flags: any, invalidRegex: any, tabl
2021
fs.writeFileSync(storagePath, csv)
2122
})
2223
console.log(regexMessages.tableOutput)
23-
console.table(tableData)
24+
const table = new Table({
25+
head: ['Module', 'Title', 'UID', 'Invalid Regex Count'],
26+
})
27+
tableData.forEach((row: any) => {
28+
table.push(row)
29+
})
30+
console.log(table.toString())
2431
console.log(regexMessages.csvOutput, storagePath)
2532
console.log(regexMessages.docsLink)
2633
} else {

src/utils/safe-regex.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ const safeRegexCheck = (document: any, invalidRegex: any, tableData: any, type:
4646
})
4747
const currentCount = invalidRegex.length - beforeCount
4848
if (currentCount > 0 && !nested) {
49-
const tableDataObject = {
50-
Module: type,
51-
Title: document.title,
52-
UID: document.uid,
53-
'Invalid Regex Count': currentCount,
54-
}
55-
tableData.push(tableDataObject)
49+
tableData.push([type, document.title, document.uid, currentCount])
5650
}
5751
}
5852
checkSchemaFieldRegex(document.schema, '', false)

0 commit comments

Comments
 (0)