diff --git a/lib/rules/require-meta-schema-description.js b/lib/rules/require-meta-schema-description.js index e267e487..4606a489 100644 --- a/lib/rules/require-meta-schema-description.js +++ b/lib/rules/require-meta-schema-description.js @@ -60,6 +60,9 @@ module.exports = { let hadDescription = false; for (const { key, value } of node.properties) { + if (!key) { + continue; + } const staticKey = key.type === 'Identifier' ? { value: key.name } : getStaticValue(key); if (!staticKey?.value) { diff --git a/tests/lib/rules/require-meta-schema-description.js b/tests/lib/rules/require-meta-schema-description.js index 6af8dadb..596da62b 100644 --- a/tests/lib/rules/require-meta-schema-description.js +++ b/tests/lib/rules/require-meta-schema-description.js @@ -162,6 +162,21 @@ module.exports = { ` const DEFAULT_OPTIONS = Object.freeze({}); +module.exports = { + meta: { + schema: [ + { + type: 'object', + properties: { + ...schemaProperties, + }, + } + ], + }, + create() {} +} + `, +` module.exports = { meta: { schema: [ @@ -179,7 +194,7 @@ module.exports = { }, create() {} } - `, + `, ], invalid: [