Skip to content

Commit e1a6b47

Browse files
committed
Clean up validation errors
1 parent 067b0e8 commit e1a6b47

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

transforms/helpers/eo-prop/private/call-expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default class EOCallExpressionProp extends AbstractEOProp<EOPropertyWithC
6464
}
6565
}
6666

67-
private get calleeName(): string {
67+
get calleeName(): string {
6868
return this.calleeObject.callee.name;
6969
}
7070

transforms/helpers/transform.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ export default function maybeTransformEmberObjects(
3030
userOptions: UserOptions
3131
): boolean | undefined {
3232
if (isTestFile(filePath)) {
33-
logger.warn(`[${filePath}]: Skipping test file`);
33+
logger.warn(`[${filePath}]: SKIPPED: test file`);
3434
return;
3535
}
3636

3737
if (userOptions.type && !isFileOfType(filePath, userOptions.type)) {
3838
logger.warn(
39-
`[${filePath}]: FAILURE Type mismatch, expected type '${userOptions.type}' did not match type of file`
39+
`[${filePath}]: SKIPPED: Type mismatch, expected type '${userOptions.type}' did not match type of file`
4040
);
4141
return;
4242
}
@@ -46,7 +46,7 @@ export default function maybeTransformEmberObjects(
4646
: getTelemetryFor(path.resolve(filePath));
4747
if (!runtimeData || !isRuntimeData(runtimeData)) {
4848
logger.warn(
49-
`[${filePath}]: SKIPPED Could not find runtime data NO_RUNTIME_DATA`
49+
`[${filePath}]: SKIPPED: Could not find runtime data NO_RUNTIME_DATA`
5050
);
5151
return;
5252
}
@@ -123,7 +123,7 @@ function _maybeTransformEmberObjects(
123123
}
124124

125125
if (errors.length > 0) {
126-
logger.warn(
126+
logger.error(
127127
`[${filePath}]: FAILURE \nValidation errors: \n\t${errors.join(
128128
'\n\t'
129129
)}`

transforms/helpers/validation-helper.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,29 @@ export function hasValidProps(
8080
}
8181

8282
if (
83-
(!decorators &&
84-
(instanceProp.hasDecorators ||
85-
instanceProp instanceof EOClassDecoratorProp)) ||
86-
unsupportedPropNames.includes(instanceProp.name) ||
87-
(instanceProp instanceof EOCallExpressionProp &&
88-
!instanceProp.hasDecorators)
83+
!decorators &&
84+
(instanceProp.hasDecorators ||
85+
instanceProp instanceof EOClassDecoratorProp ||
86+
instanceProp instanceof EOCallExpressionProp)
8987
) {
9088
errors.push(
91-
`[${instanceProp.name}]: Transform not supported - need option '--decorators=true' or the property type ${instanceProp.type} can not be transformed`
89+
`[${instanceProp.name}]: Transform not supported - need option '--decorators=true'`
90+
);
91+
}
92+
93+
if (unsupportedPropNames.includes(instanceProp.name)) {
94+
errors.push(
95+
`[${instanceProp.name}]: Transform not supported - property with name '${instanceProp.name}' and type ${instanceProp.type} can not be transformed`
9296
);
9397
}
9498

9599
if (instanceProp instanceof EOCallExpressionProp) {
100+
if (!instanceProp.hasDecorators) {
101+
errors.push(
102+
`[${instanceProp.name}]: Transform not supported - call to '${instanceProp.calleeName}' can not be transformed`
103+
);
104+
}
105+
96106
if (instanceProp.hasModifierWithArgs) {
97107
errors.push(
98108
`[${instanceProp.name}]: Transform not supported - value has modifiers like 'property' or 'meta'`

0 commit comments

Comments
 (0)