@@ -11,7 +11,6 @@ import {
11
11
import rule from 'eslint-plugin-import-x/rules/namespace'
12
12
13
13
const ruleTester = new TSESLint . RuleTester ( {
14
- parser : require . resolve ( 'espree' ) ,
15
14
parserOptions : { env : { es6 : true } } ,
16
15
} )
17
16
@@ -401,11 +400,7 @@ const invalid = [
401
400
///////////////////////
402
401
// deep dereferences //
403
402
//////////////////////
404
- for ( const [ folder , parser ] of [
405
- [ 'deep' ] ,
406
- // FIXME: check and enable
407
- // ['deep-es7', parsers.BABEL],
408
- ] ) {
403
+ for ( const [ folder , parser ] of [ [ 'deep' ] , [ 'deep-es7' , parsers . BABEL ] ] ) {
409
404
// close over params
410
405
valid . push (
411
406
test ( {
@@ -428,45 +423,45 @@ for (const [folder, parser] of [
428
423
parser,
429
424
code : `import { b } from "./${ folder } /a"; var {c:{d:{e}}} = b` ,
430
425
} ) ,
426
+ // deep namespaces should include explicitly exported defaults
427
+ test ( {
428
+ parser,
429
+ code : `import * as a from "./${ folder } /a"; console.log(a.b.default)` ,
430
+ } ) ,
431
431
)
432
432
433
- // deep namespaces should include explicitly exported defaults
434
- test ( {
435
- parser,
436
- code : `import * as a from "./${ folder } /a"; console.log(a.b.default)` ,
437
- } ) ,
438
- invalid . push (
439
- test ( {
440
- parser,
441
- code : `import * as a from "./${ folder } /a"; console.log(a.b.e)` ,
442
- errors : [ "'e' not found in deeply imported namespace 'a.b'." ] ,
443
- } ) ,
444
- test ( {
445
- parser,
446
- code : `import { b } from "./${ folder } /a"; console.log(b.e)` ,
447
- errors : [ "'e' not found in imported namespace 'b'." ] ,
448
- } ) ,
449
- test ( {
450
- parser,
451
- code : `import * as a from "./${ folder } /a"; console.log(a.b.c.e)` ,
452
- errors : [ "'e' not found in deeply imported namespace 'a.b.c'." ] ,
453
- } ) ,
454
- test ( {
455
- parser,
456
- code : `import { b } from "./${ folder } /a"; console.log(b.c.e)` ,
457
- errors : [ "'e' not found in deeply imported namespace 'b.c'." ] ,
458
- } ) ,
459
- test ( {
460
- parser,
461
- code : `import * as a from "./${ folder } /a"; var {b:{ e }} = a` ,
462
- errors : [ "'e' not found in deeply imported namespace 'a.b'." ] ,
463
- } ) ,
464
- test ( {
465
- parser,
466
- code : `import * as a from "./${ folder } /a"; var {b:{c:{ e }}} = a` ,
467
- errors : [ "'e' not found in deeply imported namespace 'a.b.c'." ] ,
468
- } ) ,
469
- )
433
+ invalid . push (
434
+ test ( {
435
+ parser,
436
+ code : `import * as a from "./${ folder } /a"; console.log(a.b.e)` ,
437
+ errors : [ "'e' not found in deeply imported namespace 'a.b'." ] ,
438
+ } ) ,
439
+ test ( {
440
+ parser,
441
+ code : `import { b } from "./${ folder } /a"; console.log(b.e)` ,
442
+ errors : [ "'e' not found in imported namespace 'b'." ] ,
443
+ } ) ,
444
+ test ( {
445
+ parser,
446
+ code : `import * as a from "./${ folder } /a"; console.log(a.b.c.e)` ,
447
+ errors : [ "'e' not found in deeply imported namespace 'a.b.c'." ] ,
448
+ } ) ,
449
+ test ( {
450
+ parser,
451
+ code : `import { b } from "./${ folder } /a"; console.log(b.c.e)` ,
452
+ errors : [ "'e' not found in deeply imported namespace 'b.c'." ] ,
453
+ } ) ,
454
+ test ( {
455
+ parser,
456
+ code : `import * as a from "./${ folder } /a"; var {b:{ e }} = a` ,
457
+ errors : [ "'e' not found in deeply imported namespace 'a.b'." ] ,
458
+ } ) ,
459
+ test ( {
460
+ parser,
461
+ code : `import * as a from "./${ folder } /a"; var {b:{c:{ e }}} = a` ,
462
+ errors : [ "'e' not found in deeply imported namespace 'a.b.c'." ] ,
463
+ } ) ,
464
+ )
470
465
}
471
466
472
467
ruleTester . run ( 'namespace' , rule , { valid, invalid } )
0 commit comments