@@ -26,6 +26,8 @@ ruleTester.run('no-invalid-config', rule, {
26
26
valid : [
27
27
'module.exports = undefined;' ,
28
28
'module.exports = "";' ,
29
+ 'module.exports = { ignorePatterns: ["node_modules/"] }' ,
30
+ 'module.exports = { ignorePatterns: "node_modules/" }' ,
29
31
dedent `
30
32
const { files } = require('./package.json');
31
33
@@ -221,12 +223,12 @@ ruleTester.run('InvalidRuleConfig', rule, {
221
223
{
222
224
files: ['*.tsx'],
223
225
rules: {
224
- camelcase : ['error', { allow : ['child_process '] }],
226
+ 'no-global-assign' : ['error', { exceptions : ['MyGlobal '] }],
225
227
}
226
228
}
227
229
],
228
230
rules: {
229
- camelcase : ['error', { allow : ['child_process '] }],
231
+ 'no-global-assign' : ['error', { exceptions : ['MyGlobal '] }],
230
232
}
231
233
};
232
234
`
@@ -256,16 +258,16 @@ ruleTester.run('InvalidRuleConfig', rule, {
256
258
code : dedent `
257
259
module.exports = {
258
260
rules: {
259
- [\`camelcase \`]: ['error', { ignore : ['child_process '] }],
261
+ [\`no-global-assign \`]: ['error', { allow : ['MyGlobal '] }],
260
262
}
261
263
};
262
264
` ,
263
265
errors : [
264
266
expectedError ( {
265
267
type : ESLintErrorType . InvalidRuleConfig ,
266
- ruleId : 'camelcase ' ,
268
+ ruleId : 'no-global-assign ' ,
267
269
reason :
268
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
270
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
269
271
path : '' ,
270
272
line : 3 ,
271
273
column : 6
@@ -276,16 +278,16 @@ ruleTester.run('InvalidRuleConfig', rule, {
276
278
code : dedent `
277
279
module.exports = {
278
280
rules: {
279
- camelcase : ['error', { ignore : ['child_process '] }],
281
+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
280
282
}
281
283
};
282
284
` ,
283
285
errors : [
284
286
expectedError ( {
285
287
type : ESLintErrorType . InvalidRuleConfig ,
286
- ruleId : 'camelcase ' ,
288
+ ruleId : 'no-global-assign ' ,
287
289
reason :
288
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
290
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
289
291
path : '' ,
290
292
line : 3 ,
291
293
column : 5
@@ -302,7 +304,7 @@ ruleTester.run('InvalidRuleConfig', rule, {
302
304
{
303
305
files: ['*'],
304
306
rules: {
305
- camelcase : ['error', { ignore : ['child_process '] }]
307
+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
306
308
}
307
309
}
308
310
]
@@ -313,9 +315,9 @@ ruleTester.run('InvalidRuleConfig', rule, {
313
315
errors : [
314
316
expectedError ( {
315
317
type : ESLintErrorType . InvalidRuleConfig ,
316
- ruleId : 'camelcase ' ,
318
+ ruleId : 'no-global-assign ' ,
317
319
reason :
318
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
320
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
319
321
path : '' ,
320
322
line : 9 ,
321
323
column : 13
@@ -329,30 +331,30 @@ ruleTester.run('InvalidRuleConfig', rule, {
329
331
{
330
332
files: ['*.tsx'],
331
333
rules: {
332
- camelcase : ['error', { ignore : ['child_process '] }],
334
+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
333
335
}
334
336
}
335
337
],
336
338
rules: {
337
- camelcase : ['error', { ignore : ['child_process '] }],
339
+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
338
340
}
339
341
};
340
342
` ,
341
343
errors : [
342
344
expectedError ( {
343
345
type : ESLintErrorType . InvalidRuleConfig ,
344
- ruleId : 'camelcase ' ,
346
+ ruleId : 'no-global-assign ' ,
345
347
reason :
346
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
348
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
347
349
path : '' ,
348
350
line : 6 ,
349
351
column : 9
350
352
} ) ,
351
353
expectedError ( {
352
354
type : ESLintErrorType . InvalidRuleConfig ,
353
- ruleId : 'camelcase ' ,
355
+ ruleId : 'no-global-assign ' ,
354
356
reason :
355
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
357
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
356
358
path : '#overrides[0]' ,
357
359
line : 11 ,
358
360
column : 5
@@ -366,30 +368,30 @@ ruleTester.run('InvalidRuleConfig', rule, {
366
368
{
367
369
files: ['*.tsx'],
368
370
rules: {
369
- camelcase : ['error', { ignore : ['child_process '] }],
371
+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
370
372
}
371
373
}
372
374
],
373
375
rules: {
374
- camelcase : ['error', { allow : ['child_process '] }],
376
+ 'no-global-assign' : ['error', { exceptions : ['MyGlobal '] }],
375
377
}
376
378
};
377
379
` ,
378
380
errors : [
379
381
expectedError ( {
380
382
type : ESLintErrorType . InvalidRuleConfig ,
381
- ruleId : 'camelcase ' ,
383
+ ruleId : 'no-global-assign ' ,
382
384
reason :
383
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
385
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
384
386
path : '' ,
385
387
line : 6 ,
386
388
column : 9
387
389
} ) ,
388
390
expectedError ( {
389
391
type : ESLintErrorType . InvalidRuleConfig ,
390
- ruleId : 'camelcase ' ,
392
+ ruleId : 'no-global-assign ' ,
391
393
reason :
392
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
394
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
393
395
path : '#overrides[0]' ,
394
396
line : 11 ,
395
397
column : 5
@@ -403,30 +405,30 @@ ruleTester.run('InvalidRuleConfig', rule, {
403
405
{
404
406
files: ['*.tsx'],
405
407
rules: {
406
- camelcase : ['error', { allow : ['child_process '] }],
408
+ 'no-global-assign' : ['error', { exceptions : ['MyGlobal '] }],
407
409
}
408
410
}
409
411
],
410
412
rules: {
411
- camelcase : ['error', { ignore : ['child_process '] }],
413
+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
412
414
}
413
415
};
414
416
` ,
415
417
errors : [
416
418
expectedError ( {
417
419
type : ESLintErrorType . InvalidRuleConfig ,
418
- ruleId : 'camelcase ' ,
420
+ ruleId : 'no-global-assign ' ,
419
421
reason :
420
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
422
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
421
423
path : '' ,
422
424
line : 6 ,
423
425
column : 9
424
426
} ) ,
425
427
expectedError ( {
426
428
type : ESLintErrorType . InvalidRuleConfig ,
427
- ruleId : 'camelcase ' ,
429
+ ruleId : 'no-global-assign ' ,
428
430
reason :
429
- '\n\tValue {"ignore ":["child_process"],"ignoreDestructuring":false,"ignoreImports":false } should NOT have additional properties.' ,
431
+ '\n\tValue {"allow ":["MyGlobal"] } should NOT have additional properties.' ,
430
432
path : '#overrides[0]' ,
431
433
line : 11 ,
432
434
column : 5
@@ -748,6 +750,21 @@ ruleTester.run('InvalidConfig', rule, {
748
750
column : 1
749
751
} )
750
752
]
753
+ } ,
754
+ {
755
+ code : 'module.exports = { ignorePatterns: [1] }' ,
756
+ errors : [
757
+ expectedError ( {
758
+ type : ESLintErrorType . InvalidConfig ,
759
+ reason : [
760
+ '\n\t- Property "ignorePatterns" is the wrong type (expected string but got `[1]`).' ,
761
+ '\n\t- Property "ignorePatterns[0]" is the wrong type (expected string but got `1`).' ,
762
+ '\n\t- "ignorePatterns" should match exactly one schema in oneOf. Value: [1].'
763
+ ] . join ( '' ) ,
764
+ line : 1 ,
765
+ column : 1
766
+ } )
767
+ ]
751
768
}
752
769
]
753
770
} ) ;
0 commit comments