More robustness on lack of space config
parent
8348c473e3
commit
409b0df328
|
@ -141,7 +141,7 @@ export function systemSyscalls(
|
|||
return commonSystem.applyAttributeExtractors(tags, text, tree);
|
||||
},
|
||||
"system.getSpaceConfig": (_ctx, key?: string): any => {
|
||||
const config: any = configContainer.config;
|
||||
const config: any = configContainer.config || {};
|
||||
if (key) {
|
||||
return config[key];
|
||||
} else {
|
||||
|
|
|
@ -22,7 +22,7 @@ export async function lintYAML({ tree }: LintEvent): Promise<LintDiagnostic[]> {
|
|||
const diagnostics: LintDiagnostic[] = [];
|
||||
const frontmatter = await extractFrontmatter(tree);
|
||||
const tags = ["page", ...frontmatter.tags || []];
|
||||
const schemaConfig = await system.getSpaceConfig("schema");
|
||||
const schemaConfig = await system.getSpaceConfig("schema", {});
|
||||
await traverseTreeAsync(tree, async (node) => {
|
||||
if (node.type === "FrontMatterCode") {
|
||||
// Query all readOnly attributes for pages with this tag set
|
||||
|
@ -110,7 +110,7 @@ export async function lintYAML({ tree }: LintEvent): Promise<LintDiagnostic[]> {
|
|||
let parsed = await YAML.parse(yamlCode);
|
||||
parsed = cleanupJSON(parsed);
|
||||
// If tag schemas are defined, validate them
|
||||
if (parsed.schema?.tag) {
|
||||
if (parsed?.schema?.tag) {
|
||||
for (
|
||||
let [tagName, tagSchema] of Object.entries(parsed.schema.tag)
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue