Skip to content

Commit b250c7d

Browse files
committed
fix: linter log undefined name
1 parent 8fc3ebe commit b250c7d

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

apps/cli/src/command/lint.command.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import pluralize from 'pluralize';
44
import { ZodError } from 'zod';
55

66
import { check } from '../linter';
7+
import { SignaleRenderer } from '../utils/listr';
78
import { LoadLocalConfigurationTask } from './diff.command';
89
import { BaseCommand } from './helper';
910

@@ -28,7 +29,13 @@ export const LintTask = (): ListrTask<{ local: ADCSDK.Configuration }> => ({
2829

2930
// normal case
3031
const resourceType = pluralize.singular(error.path[0] as string);
31-
const resourceName = ctx.local[error.path[0]][error.path[1]].name;
32+
const resource = ctx.local[error.path[0]][error.path[1]];
33+
const resourceName =
34+
resourceType === 'ssl'
35+
? resource.snis
36+
: resourceType === 'consumer'
37+
? resource.username
38+
: resource.name;
3239
err += `#${idx + 1} ${
3340
error.message
3441
} at ${resourceType}: "${resourceName}", field: "${(
@@ -59,10 +66,13 @@ export const LintCommand = new BaseCommand('lint')
5966
.action(async () => {
6067
const opts = LintCommand.optsWithGlobals();
6168

62-
const tasks = new Listr([
63-
LoadLocalConfigurationTask(opts.file, {}),
64-
LintTask(),
65-
]);
69+
const tasks = new Listr(
70+
[LoadLocalConfigurationTask(opts.file, {}), LintTask()],
71+
{
72+
renderer: SignaleRenderer,
73+
rendererOptions: { verbose: opts.verbose },
74+
},
75+
);
6676

6777
try {
6878
await tasks.run();

0 commit comments

Comments
 (0)