@@ -37,6 +37,25 @@ ruleTester.run('require-meta-type', rule, {
37
37
create(context) {}
38
38
};
39
39
` ,
40
+ `
41
+ const type = 'problem';
42
+ module.exports = {
43
+ meta: { type },
44
+ create(context) {}
45
+ };
46
+ ` ,
47
+ `
48
+ module.exports = {
49
+ meta: { type: getType() },
50
+ create(context) {}
51
+ };
52
+ ` ,
53
+ `
54
+ module.exports = {
55
+ meta: { type: FOO },
56
+ create(context) {}
57
+ };
58
+ ` ,
40
59
`module.exports = {
41
60
create(context) {}
42
61
}` ,
@@ -60,7 +79,7 @@ ruleTester.run('require-meta-type', rule, {
60
79
create(context) {}
61
80
};
62
81
` ,
63
- errors : [ { messageId : 'missing' } ] ,
82
+ errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
64
83
} ,
65
84
{
66
85
code : `
@@ -70,7 +89,7 @@ ruleTester.run('require-meta-type', rule, {
70
89
create,
71
90
};
72
91
` ,
73
- errors : [ { messageId : 'missing' } ] ,
92
+ errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
74
93
} ,
75
94
{
76
95
code : `
@@ -80,7 +99,7 @@ ruleTester.run('require-meta-type', rule, {
80
99
create,
81
100
};
82
101
` ,
83
- errors : [ { messageId : 'missing' } ] ,
102
+ errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
84
103
} ,
85
104
{
86
105
code : `
@@ -90,7 +109,7 @@ ruleTester.run('require-meta-type', rule, {
90
109
create,
91
110
};
92
111
` ,
93
- errors : [ { messageId : 'missing' } ] ,
112
+ errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
94
113
} ,
95
114
{
96
115
code : `
@@ -99,7 +118,35 @@ ruleTester.run('require-meta-type', rule, {
99
118
create(context) {}
100
119
};
101
120
` ,
102
- errors : [ { messageId : 'unexpected' } ] ,
121
+ errors : [ { messageId : 'unexpected' , type : 'Literal' } ] ,
122
+ } ,
123
+ {
124
+ code : `
125
+ const type = 'invalid-type';
126
+ module.exports = {
127
+ meta: { type },
128
+ create(context) {}
129
+ };
130
+ ` ,
131
+ errors : [ { messageId : 'unexpected' , type : 'Identifier' } ] ,
132
+ } ,
133
+ {
134
+ code : `
135
+ module.exports = {
136
+ meta: { type: null },
137
+ create(context) {}
138
+ };
139
+ ` ,
140
+ errors : [ { messageId : 'unexpected' , type : 'Literal' } ] ,
141
+ } ,
142
+ {
143
+ code : `
144
+ module.exports = {
145
+ meta: { type: undefined },
146
+ create(context) {}
147
+ };
148
+ ` ,
149
+ errors : [ { messageId : 'unexpected' , type : 'Identifier' } ] ,
103
150
} ,
104
151
] ,
105
152
} ) ;
0 commit comments