@@ -26,6 +26,8 @@ ruleTester.run('no-invalid-config', rule, {
2626 valid : [
2727 'module.exports = undefined;' ,
2828 'module.exports = "";' ,
29+ 'module.exports = { ignorePatterns: ["node_modules/"] }' ,
30+ 'module.exports = { ignorePatterns: "node_modules/" }' ,
2931 dedent `
3032 const { files } = require('./package.json');
3133
@@ -221,12 +223,12 @@ ruleTester.run('InvalidRuleConfig', rule, {
221223 {
222224 files: ['*.tsx'],
223225 rules: {
224- camelcase : ['error', { allow : ['child_process '] }],
226+ 'no-global-assign' : ['error', { exceptions : ['MyGlobal '] }],
225227 }
226228 }
227229 ],
228230 rules: {
229- camelcase : ['error', { allow : ['child_process '] }],
231+ 'no-global-assign' : ['error', { exceptions : ['MyGlobal '] }],
230232 }
231233 };
232234 `
@@ -256,16 +258,16 @@ ruleTester.run('InvalidRuleConfig', rule, {
256258 code : dedent `
257259 module.exports = {
258260 rules: {
259- [\`camelcase \`]: ['error', { ignore : ['child_process '] }],
261+ [\`no-global-assign \`]: ['error', { allow : ['MyGlobal '] }],
260262 }
261263 };
262264 ` ,
263265 errors : [
264266 expectedError ( {
265267 type : ESLintErrorType . InvalidRuleConfig ,
266- ruleId : 'camelcase ' ,
268+ ruleId : 'no-global-assign ' ,
267269 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.' ,
269271 path : '' ,
270272 line : 3 ,
271273 column : 6
@@ -276,16 +278,16 @@ ruleTester.run('InvalidRuleConfig', rule, {
276278 code : dedent `
277279 module.exports = {
278280 rules: {
279- camelcase : ['error', { ignore : ['child_process '] }],
281+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
280282 }
281283 };
282284 ` ,
283285 errors : [
284286 expectedError ( {
285287 type : ESLintErrorType . InvalidRuleConfig ,
286- ruleId : 'camelcase ' ,
288+ ruleId : 'no-global-assign ' ,
287289 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.' ,
289291 path : '' ,
290292 line : 3 ,
291293 column : 5
@@ -302,7 +304,7 @@ ruleTester.run('InvalidRuleConfig', rule, {
302304 {
303305 files: ['*'],
304306 rules: {
305- camelcase : ['error', { ignore : ['child_process '] }]
307+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
306308 }
307309 }
308310 ]
@@ -313,9 +315,9 @@ ruleTester.run('InvalidRuleConfig', rule, {
313315 errors : [
314316 expectedError ( {
315317 type : ESLintErrorType . InvalidRuleConfig ,
316- ruleId : 'camelcase ' ,
318+ ruleId : 'no-global-assign ' ,
317319 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.' ,
319321 path : '' ,
320322 line : 9 ,
321323 column : 13
@@ -329,30 +331,30 @@ ruleTester.run('InvalidRuleConfig', rule, {
329331 {
330332 files: ['*.tsx'],
331333 rules: {
332- camelcase : ['error', { ignore : ['child_process '] }],
334+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
333335 }
334336 }
335337 ],
336338 rules: {
337- camelcase : ['error', { ignore : ['child_process '] }],
339+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
338340 }
339341 };
340342 ` ,
341343 errors : [
342344 expectedError ( {
343345 type : ESLintErrorType . InvalidRuleConfig ,
344- ruleId : 'camelcase ' ,
346+ ruleId : 'no-global-assign ' ,
345347 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.' ,
347349 path : '' ,
348350 line : 6 ,
349351 column : 9
350352 } ) ,
351353 expectedError ( {
352354 type : ESLintErrorType . InvalidRuleConfig ,
353- ruleId : 'camelcase ' ,
355+ ruleId : 'no-global-assign ' ,
354356 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.' ,
356358 path : '#overrides[0]' ,
357359 line : 11 ,
358360 column : 5
@@ -366,30 +368,30 @@ ruleTester.run('InvalidRuleConfig', rule, {
366368 {
367369 files: ['*.tsx'],
368370 rules: {
369- camelcase : ['error', { ignore : ['child_process '] }],
371+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
370372 }
371373 }
372374 ],
373375 rules: {
374- camelcase : ['error', { allow : ['child_process '] }],
376+ 'no-global-assign' : ['error', { exceptions : ['MyGlobal '] }],
375377 }
376378 };
377379 ` ,
378380 errors : [
379381 expectedError ( {
380382 type : ESLintErrorType . InvalidRuleConfig ,
381- ruleId : 'camelcase ' ,
383+ ruleId : 'no-global-assign ' ,
382384 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.' ,
384386 path : '' ,
385387 line : 6 ,
386388 column : 9
387389 } ) ,
388390 expectedError ( {
389391 type : ESLintErrorType . InvalidRuleConfig ,
390- ruleId : 'camelcase ' ,
392+ ruleId : 'no-global-assign ' ,
391393 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.' ,
393395 path : '#overrides[0]' ,
394396 line : 11 ,
395397 column : 5
@@ -403,30 +405,30 @@ ruleTester.run('InvalidRuleConfig', rule, {
403405 {
404406 files: ['*.tsx'],
405407 rules: {
406- camelcase : ['error', { allow : ['child_process '] }],
408+ 'no-global-assign' : ['error', { exceptions : ['MyGlobal '] }],
407409 }
408410 }
409411 ],
410412 rules: {
411- camelcase : ['error', { ignore : ['child_process '] }],
413+ 'no-global-assign' : ['error', { allow : ['MyGlobal '] }],
412414 }
413415 };
414416 ` ,
415417 errors : [
416418 expectedError ( {
417419 type : ESLintErrorType . InvalidRuleConfig ,
418- ruleId : 'camelcase ' ,
420+ ruleId : 'no-global-assign ' ,
419421 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.' ,
421423 path : '' ,
422424 line : 6 ,
423425 column : 9
424426 } ) ,
425427 expectedError ( {
426428 type : ESLintErrorType . InvalidRuleConfig ,
427- ruleId : 'camelcase ' ,
429+ ruleId : 'no-global-assign ' ,
428430 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.' ,
430432 path : '#overrides[0]' ,
431433 line : 11 ,
432434 column : 5
@@ -748,6 +750,21 @@ ruleTester.run('InvalidConfig', rule, {
748750 column : 1
749751 } )
750752 ]
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+ ]
751768 }
752769 ]
753770} ) ;
0 commit comments