@@ -63,20 +63,57 @@ ruleTester.run('require-meta-schema', rule, {
6363 ` ,
6464 parserOptions : { sourceType : 'module' } ,
6565 } ,
66+ // Variable schema with array value.
6667 `
6768 const schema = [];
6869 module.exports = {
6970 meta: { schema },
7071 create(context) {}
7172 };
7273 ` ,
74+ // Variable schema with object value.
7375 `
7476 const foo = {};
7577 module.exports = {
7678 meta: { schema: foo },
7779 create(context) {}
7880 };
7981 ` ,
82+ // Variable schema with no static value.
83+ `
84+ module.exports = {
85+ meta: { schema },
86+ create(context) {}
87+ };
88+ ` ,
89+ // Variable schema pointing to unknown variable chain.
90+ `
91+ module.exports = {
92+ meta: { schema: baseRule.meta.schema },
93+ create(context) {}
94+ };
95+ ` ,
96+ // Schema with function call as value.
97+ `
98+ module.exports = {
99+ meta: { schema: getSchema() },
100+ create(context) {}
101+ };
102+ ` ,
103+ // Schema with ternary (conditional) expression.
104+ `
105+ module.exports = {
106+ meta: { schema: foo ? [] : {} },
107+ create(context) {}
108+ };
109+ ` ,
110+ // Schema with logical expression.
111+ `
112+ module.exports = {
113+ meta: { schema: foo || {} },
114+ create(context) {}
115+ };
116+ ` ,
80117 `
81118 let schema;
82119 schema = foo ? [] : {};
@@ -296,6 +333,28 @@ schema: [] },
296333 output : null ,
297334 errors : [ { messageId : 'wrongType' , type : 'Identifier' , suggestions : [ ] } ] ,
298335 } ,
336+ {
337+ // Schema with number literal value.
338+ code : `
339+ module.exports = {
340+ meta: { schema: 123 },
341+ create(context) {}
342+ };
343+ ` ,
344+ output : null ,
345+ errors : [ { messageId : 'wrongType' , type : 'Literal' , suggestions : [ ] } ] ,
346+ } ,
347+ {
348+ // Schema with string literal value.
349+ code : `
350+ module.exports = {
351+ meta: { schema: 'hello world' },
352+ create(context) {}
353+ };
354+ ` ,
355+ output : null ,
356+ errors : [ { messageId : 'wrongType' , type : 'Literal' , suggestions : [ ] } ] ,
357+ } ,
299358 {
300359 code : `
301360 const schema = null;
0 commit comments