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