Skip to content

Commit 8630901

Browse files
azat-ioaladdin-add
authored andcommitted
fix: fix require-meta-schema-description rule crash
1 parent 6fa563e commit 8630901

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/rules/require-meta-schema-description.js

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ module.exports = {
6060
let hadDescription = false;
6161

6262
for (const { key, value } of node.properties) {
63+
if (!key) {
64+
continue;
65+
}
6366
const staticKey =
6467
key.type === 'Identifier' ? { value: key.name } : getStaticValue(key);
6568
if (!staticKey?.value) {

tests/lib/rules/require-meta-schema-description.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ module.exports = {
162162
`
163163
const DEFAULT_OPTIONS = Object.freeze({});
164164
165+
module.exports = {
166+
meta: {
167+
schema: [
168+
{
169+
type: 'object',
170+
properties: {
171+
...schemaProperties,
172+
},
173+
}
174+
],
175+
},
176+
create() {}
177+
}
178+
`,
179+
`
165180
module.exports = {
166181
meta: {
167182
schema: [
@@ -179,7 +194,7 @@ module.exports = {
179194
},
180195
create() {}
181196
}
182-
`,
197+
`,
183198
],
184199

185200
invalid: [

0 commit comments

Comments
 (0)