@@ -90,7 +90,9 @@ ruleTester.run('require-meta-docs-recommended', rule, {
90
90
{
91
91
code : 'module.exports = { create(context) {} };' ,
92
92
output : null ,
93
- errors : [ { messageId : 'missing' , type : 'FunctionExpression' } ] ,
93
+ errors : [
94
+ { messageId : 'missing' , type : 'FunctionExpression' , suggestions : [ ] } ,
95
+ ] ,
94
96
} ,
95
97
{
96
98
code : `
@@ -100,7 +102,13 @@ ruleTester.run('require-meta-docs-recommended', rule, {
100
102
};
101
103
` ,
102
104
output : null ,
103
- errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
105
+ errors : [
106
+ {
107
+ messageId : 'missing' ,
108
+ type : 'ObjectExpression' ,
109
+ suggestions : [ ] ,
110
+ } ,
111
+ ] ,
104
112
} ,
105
113
{
106
114
code : `
@@ -110,7 +118,32 @@ ruleTester.run('require-meta-docs-recommended', rule, {
110
118
};
111
119
` ,
112
120
output : null ,
113
- errors : [ { messageId : 'missing' , type : 'Property' } ] ,
121
+ errors : [
122
+ {
123
+ messageId : 'missing' ,
124
+ type : 'Property' ,
125
+ suggestions : [
126
+ {
127
+ messageId : 'setRecommendedTrue' ,
128
+ output : `
129
+ module.exports = {
130
+ meta: { docs: { recommended: true } },
131
+ create(context) {}
132
+ };
133
+ ` ,
134
+ } ,
135
+ {
136
+ messageId : 'setRecommendedFalse' ,
137
+ output : `
138
+ module.exports = {
139
+ meta: { docs: { recommended: false } },
140
+ create(context) {}
141
+ };
142
+ ` ,
143
+ } ,
144
+ ] ,
145
+ } ,
146
+ ] ,
114
147
} ,
115
148
{
116
149
code : `
@@ -120,7 +153,32 @@ ruleTester.run('require-meta-docs-recommended', rule, {
120
153
};
121
154
` ,
122
155
output : null ,
123
- errors : [ { messageId : 'incorrect' , type : 'Identifier' } ] ,
156
+ errors : [
157
+ {
158
+ messageId : 'incorrect' ,
159
+ type : 'Identifier' ,
160
+ suggestions : [
161
+ {
162
+ messageId : 'setRecommendedTrue' ,
163
+ output : `
164
+ module.exports = {
165
+ meta: { docs: { recommended: true } },
166
+ create(context) {}
167
+ };
168
+ ` ,
169
+ } ,
170
+ {
171
+ messageId : 'setRecommendedFalse' ,
172
+ output : `
173
+ module.exports = {
174
+ meta: { docs: { recommended: false } },
175
+ create(context) {}
176
+ };
177
+ ` ,
178
+ } ,
179
+ ] ,
180
+ } ,
181
+ ] ,
124
182
} ,
125
183
{
126
184
code : `
@@ -130,7 +188,32 @@ ruleTester.run('require-meta-docs-recommended', rule, {
130
188
};
131
189
` ,
132
190
output : null ,
133
- errors : [ { messageId : 'incorrect' , type : 'Literal' } ] ,
191
+ errors : [
192
+ {
193
+ messageId : 'incorrect' ,
194
+ type : 'Literal' ,
195
+ suggestions : [
196
+ {
197
+ messageId : 'setRecommendedTrue' ,
198
+ output : `
199
+ module.exports = {
200
+ meta: { docs: { recommended: true } },
201
+ create(context) {}
202
+ };
203
+ ` ,
204
+ } ,
205
+ {
206
+ messageId : 'setRecommendedFalse' ,
207
+ output : `
208
+ module.exports = {
209
+ meta: { docs: { recommended: false } },
210
+ create(context) {}
211
+ };
212
+ ` ,
213
+ } ,
214
+ ] ,
215
+ } ,
216
+ ] ,
134
217
} ,
135
218
{
136
219
code : `
@@ -142,13 +225,44 @@ ruleTester.run('require-meta-docs-recommended', rule, {
142
225
};
143
226
` ,
144
227
output : null ,
145
- errors : [ { messageId : 'missing' , type : 'Property' } ] ,
228
+ errors : [
229
+ {
230
+ messageId : 'missing' ,
231
+ type : 'Property' ,
232
+ suggestions : [
233
+ {
234
+ messageId : 'setRecommendedTrue' ,
235
+ output : `
236
+ const extraDocs = { };
237
+ const extraMeta = { docs: { ...extraDocs, recommended: true } };
238
+ module.exports = {
239
+ meta: { ...extraMeta },
240
+ create(context) {}
241
+ };
242
+ ` ,
243
+ } ,
244
+ {
245
+ messageId : 'setRecommendedFalse' ,
246
+ output : `
247
+ const extraDocs = { };
248
+ const extraMeta = { docs: { ...extraDocs, recommended: false } };
249
+ module.exports = {
250
+ meta: { ...extraMeta },
251
+ create(context) {}
252
+ };
253
+ ` ,
254
+ } ,
255
+ ] ,
256
+ } ,
257
+ ] ,
146
258
} ,
147
259
{
148
260
code : 'module.exports = { create(context) {} };' ,
149
261
output : null ,
150
262
options : [ { allowNonBoolean : true } ] ,
151
- errors : [ { messageId : 'missing' , type : 'FunctionExpression' } ] ,
263
+ errors : [
264
+ { messageId : 'missing' , type : 'FunctionExpression' , suggestions : [ ] } ,
265
+ ] ,
152
266
} ,
153
267
] ,
154
268
} ) ;
@@ -178,7 +292,9 @@ ruleTesterTypeScript.run('require-meta-docs-recommended (TypeScript)', rule, {
178
292
});
179
293
` ,
180
294
output : null ,
181
- errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
295
+ errors : [
296
+ { messageId : 'missing' , type : 'ObjectExpression' , suggestions : [ ] } ,
297
+ ] ,
182
298
} ,
183
299
] ,
184
300
} ) ;
0 commit comments