diff --git a/lib/rules/require-meta-schema-description.js b/lib/rules/require-meta-schema-description.js index 5705f8db..e267e487 100644 --- a/lib/rules/require-meta-schema-description.js +++ b/lib/rules/require-meta-schema-description.js @@ -87,9 +87,11 @@ module.exports = { case 'properties': { hadChildren = true; - for (const property of value.properties) { - if (property.value?.type === 'ObjectExpression') { - checkSchemaElement(property.value); + if (Array.isArray(value.properties)) { + for (const property of value.properties) { + if (property.value?.type === 'ObjectExpression') { + checkSchemaElement(property.value); + } } } diff --git a/tests/lib/rules/require-meta-schema-description.js b/tests/lib/rules/require-meta-schema-description.js index f6171c51..6af8dadb 100644 --- a/tests/lib/rules/require-meta-schema-description.js +++ b/tests/lib/rules/require-meta-schema-description.js @@ -145,6 +145,41 @@ module.exports = { create() {} }; `, + ` +module.exports = { + meta: { + schema: [ + { + type: 'object', + properties: null, + additionalProperties: false + } + ], + }, + create() {} +} + `, + ` +const DEFAULT_OPTIONS = Object.freeze({}); + +module.exports = { + meta: { + schema: [ + { + type: 'object', + properties: Object.fromEntries( + Object.keys(DEFAULT_OPTIONS).map((code) => [ + code, + { type: 'boolean' } + ]) + ), + additionalProperties: false + } + ], + }, + create() {} +} + `, ], invalid: [