@@ -20,15 +20,10 @@ export default function maybeTransformEmberObjects(
2020 filePath : string ,
2121 userOptions : UserOptions
2222) : boolean {
23- const options : Options = {
24- ...userOptions ,
25- runtimeData : getRuntimeData ( filePath ) ,
26- } ;
27-
2823 const { results, decoratorImportSpecs } = _maybeTransformEmberObjects (
2924 root ,
3025 filePath ,
31- options
26+ userOptions
3227 ) ;
3328
3429 for ( const result of results ) {
@@ -44,15 +39,15 @@ export default function maybeTransformEmberObjects(
4439 const decoratorsToImport = Object . keys ( decoratorImportSpecs ) . filter (
4540 ( key ) => decoratorImportSpecs [ key as keyof DecoratorImportSpecs ]
4641 ) ;
47- createDecoratorImportDeclarations ( root , decoratorsToImport , options ) ;
42+ createDecoratorImportDeclarations ( root , decoratorsToImport , userOptions ) ;
4843
4944 return results . length > 0 && results . every ( ( r ) => r . success ) ;
5045}
5146
5247function _maybeTransformEmberObjects (
5348 root : AST . Collection ,
5449 filePath : string ,
55- options : Options
50+ userOptions : UserOptions
5651) : {
5752 results : TransformResult [ ] ;
5853 decoratorImportSpecs : DecoratorImportSpecs ;
@@ -79,27 +74,32 @@ function _maybeTransformEmberObjects(
7974 filePath,
8075 info : "UNMODIFIED: Did not find any 'EmberObject.extend()' expressions" ,
8176 } ) ;
82- }
77+ } else {
78+ const options : Options = {
79+ ...userOptions ,
80+ runtimeData : getRuntimeData ( filePath ) ,
81+ } ;
8382
84- // eslint-disable-next-line unicorn/no-array-for-each
85- eoExtendExpressionPaths . forEach ( ( eoExtendExpressionPath ) => {
86- const extendExpression = new EOExtendExpression (
87- eoExtendExpressionPath ,
88- filePath ,
89- existingDecoratorImportInfos ,
90- options
91- ) ;
83+ // eslint-disable-next-line unicorn/no-array-for-each
84+ eoExtendExpressionPaths . forEach ( ( eoExtendExpressionPath ) => {
85+ const extendExpression = new EOExtendExpression (
86+ eoExtendExpressionPath ,
87+ filePath ,
88+ existingDecoratorImportInfos ,
89+ options
90+ ) ;
9291
93- const result = extendExpression . transform ( ) ;
94- results . push ( result ) ;
92+ const result = extendExpression . transform ( ) ;
93+ results . push ( result ) ;
9594
96- if ( result . success ) {
97- decoratorImportSpecs = mergeDecoratorImportSpecs (
98- extendExpression . decoratorImportSpecs ,
99- decoratorImportSpecs
100- ) ;
101- }
102- } ) ;
95+ if ( result . success ) {
96+ decoratorImportSpecs = mergeDecoratorImportSpecs (
97+ extendExpression . decoratorImportSpecs ,
98+ decoratorImportSpecs
99+ ) ;
100+ }
101+ } ) ;
102+ }
103103
104104 return { results, decoratorImportSpecs } ;
105105}
0 commit comments