update unknownConfigKey error messages
parent
20c41600db
commit
b052884ad4
|
@ -279,9 +279,13 @@ function getUnknownConfigKeyDiagnostics(
|
||||||
let keys = match.groups.key.split(/[.\[\]]/).filter(Boolean)
|
let keys = match.groups.key.split(/[.\[\]]/).filter(Boolean)
|
||||||
let value = dlv(state.config, [...base, ...keys])
|
let value = dlv(state.config, [...base, ...keys])
|
||||||
|
|
||||||
// TODO: check that the type is valid
|
if (
|
||||||
// e.g. objects are not valid
|
typeof value === 'string' ||
|
||||||
if (typeof value !== 'undefined') {
|
typeof value === 'number' ||
|
||||||
|
value instanceof String ||
|
||||||
|
value instanceof Number ||
|
||||||
|
Array.isArray(value)
|
||||||
|
) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +308,10 @@ function getUnknownConfigKeyDiagnostics(
|
||||||
severity === 'error'
|
severity === 'error'
|
||||||
? DiagnosticSeverity.Error
|
? DiagnosticSeverity.Error
|
||||||
: DiagnosticSeverity.Warning,
|
: DiagnosticSeverity.Warning,
|
||||||
message: `Unknown ${match.groups.helper} key: ${match.groups.key}`,
|
message:
|
||||||
|
typeof value === 'undefined'
|
||||||
|
? `'${match.groups.key}' does not exist in your theme config.`
|
||||||
|
: `'${match.groups.key}' was found but does not resolve to a string.`,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue