Skip to content

Commit

Permalink
chore(website): correct schema autocompletion in playground (#7557)
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Sep 8, 2023
1 parent c15daf9 commit ec6a62e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/website/src/components/lib/jsonSchema.ts
Expand Up @@ -37,11 +37,12 @@ export function getRuleJsonSchemaWithErrorLevel(
additionalItems: false,
};
}
if (ruleSchema.type === 'array') {
if ('items' in ruleSchema) {
// example: explicit-member-accessibility
if (isArray(ruleSchema.items)) {
return {
...ruleSchema,
type: 'array',
items: [defaultRuleSchema, ...ruleSchema.items],
maxItems: ruleSchema.maxItems ? ruleSchema.maxItems + 1 : undefined,
minItems: ruleSchema.minItems ? ruleSchema.minItems + 1 : 1,
Expand All @@ -52,7 +53,10 @@ export function getRuleJsonSchemaWithErrorLevel(
if (typeof ruleSchema.items === 'object' && ruleSchema.items) {
return {
...ruleSchema,
type: 'array',
items: [defaultRuleSchema],
maxItems: ruleSchema.maxItems ? ruleSchema.maxItems + 1 : undefined,
minItems: ruleSchema.minItems ? ruleSchema.minItems + 1 : 1,
additionalItems: ruleSchema.items,
};
}
Expand Down Expand Up @@ -114,7 +118,7 @@ export function getEslintJsonSchema(
{ type: 'string' },
{
type: 'array',
items: { type: 'string', enum: Object.keys(linter.configs) },
items: { type: 'string', enum: linter.configs },
uniqueItems: true,
},
],
Expand Down

0 comments on commit ec6a62e

Please sign in to comment.