@@ -128,6 +128,18 @@ ruleTester.run('no-extraneous-dependencies', rule, {
128
128
code : 'import leftpad from "left-pad";' ,
129
129
options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'dev' ] } ] ,
130
130
} ) ,
131
+ test ( {
132
+ code : 'import lodash from "lodash";' ,
133
+ options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'peer' ] } ] ,
134
+ } ) ,
135
+ test ( {
136
+ code : 'import chalk from "chalk";' ,
137
+ options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'optional' ] } ] ,
138
+ } ) ,
139
+ test ( {
140
+ code : 'import commander from "commander";' ,
141
+ options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'bundled' ] } ] ,
142
+ } ) ,
131
143
test ( { code : 'import foo from "@generated/foo"' } ) ,
132
144
test ( {
133
145
code : 'import foo from "@generated/foo"' ,
@@ -331,13 +343,48 @@ ruleTester.run('no-extraneous-dependencies', rule, {
331
343
message : "'left-pad' should be listed in the project's dependencies. Run 'npm i -S left-pad' to add it" ,
332
344
} ] ,
333
345
} ) ,
346
+ test ( {
347
+ code : 'import rightpad from "right-pad";' ,
348
+ options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ ] } ] ,
349
+ errors : [ {
350
+ message : "'right-pad' should be listed in the project's dependencies. Run 'npm i -S right-pad' to add it" ,
351
+ } ] ,
352
+ } ) ,
353
+ test ( {
354
+ code : 'import rightpad from "right-pad";' ,
355
+ options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'dev' ] } ] ,
356
+ errors : [ {
357
+ message : "'right-pad' should be listed in the project's dependencies. Run 'npm i -S right-pad' to add it" ,
358
+ } ] ,
359
+ } ) ,
334
360
test ( {
335
361
code : 'import leftpad from "left-pad";' ,
336
362
options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'prod' ] } ] ,
337
363
errors : [ {
338
364
message : "'left-pad' should be listed in the project's dependencies. Run 'npm i -S left-pad' to add it" ,
339
365
} ] ,
340
366
} ) ,
367
+ test ( {
368
+ code : 'import lodash from "lodash";' ,
369
+ options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'prod' ] } ] ,
370
+ errors : [ {
371
+ message : "'lodash' should be listed in the project's dependencies. Run 'npm i -S lodash' to add it" ,
372
+ } ] ,
373
+ } ) ,
374
+ test ( {
375
+ code : 'import chalk from "chalk";' ,
376
+ options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'prod' ] } ] ,
377
+ errors : [ {
378
+ message : "'chalk' should be listed in the project's dependencies. Run 'npm i -S chalk' to add it" ,
379
+ } ] ,
380
+ } ) ,
381
+ test ( {
382
+ code : 'import commander from "commander";' ,
383
+ options : [ { packageDir : packageDirMonoRepoWithNested , considerInParents : [ 'prod' ] } ] ,
384
+ errors : [ {
385
+ message : "'commander' should be listed in the project's dependencies. Run 'npm i -S commander' to add it" ,
386
+ } ] ,
387
+ } ) ,
341
388
test ( {
342
389
code : 'import react from "react";' ,
343
390
filename : path . join ( packageDirMonoRepoRoot , 'foo.js' ) ,
0 commit comments