Skip to content

Commit b876185

Browse files
committed
Add alerts to output
v1.11.0 of hpt-validator adds alerts to the validation result. Show a message if there are no alerts. If there is at least one alert, show a table containing the alerts.
1 parent 9cca7e8 commit b876185

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"dependencies": {
2222
"chalk": "^5.3.0",
2323
"commander": "^12.1.0",
24-
"hpt-validator": "^1.10.0"
24+
"hpt-validator": "^1.11.0"
2525
},
2626
"devDependencies": {
2727
"@stylistic/eslint-plugin-js": "^2.9.0",

src/commands.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export async function validate(
5050

5151
console.log(`Validator run completed at ${new Date().toString()}`)
5252
const errors = validationResult.errors
53+
const alerts = validationResult.alerts
5354

5455
if (errors.length > 0) {
5556
console.log(
@@ -61,6 +62,14 @@ export async function validate(
6162
} else {
6263
console.log(chalk.green("No errors found"))
6364
}
65+
if (alerts) {
66+
console.log(
67+
chalk.yellow(
68+
`${alerts.length === 1 ? "1 alert" : `${alerts.length} alerts`} found`
69+
)
70+
)
71+
console.table(alerts)
72+
}
6473
}
6574

6675
async function validateFile(

0 commit comments

Comments
 (0)