Themes: add warning if a tagRendering can be replaced by a direct value

This commit is contained in:
Pieter Vander Vennet 2023-11-19 18:08:57 +01:00
parent 29b1f5be4d
commit 79e40d0fee

View file

@ -813,6 +813,12 @@ class MiscTagRenderingChecks extends DesugaringStep<TagRenderingConfigJson> {
)
}
if (Object.keys(json).length === 1 && typeof json["render"] === "string") {
context.warn(
`use the content directly instead of {render: ${JSON.stringify(json["render"])}}`
)
}
{
for (const key of ["question", "questionHint", "render"]) {
CheckTranslation.allowUndefined.convert(json[key], context.enter(key))