File tree 4 files changed +6
-22
lines changed
fixtures/import-star-iteration
4 files changed +6
-22
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " @fixtures/import-star-iteration" ,
3
- "devDependencies" : {
4
- "ts-node" : " ^10.8.2"
5
- },
6
- "scripts" : {
7
- "execute-test-code" : " ts-node index.ts"
8
- },
9
- "knip" : {
10
- "ignoreBinaries" : [
11
- " ts-node"
12
- ],
13
- "ignoreDependencies" : [
14
- " ts-node"
15
- ]
16
- }
2
+ "name" : " @fixtures/import-star-iteration"
17
3
}
Original file line number Diff line number Diff line change @@ -165,11 +165,6 @@ export const isDestructuring = (node: ts.Node) =>
165
165
ts . isVariableDeclarationList ( node . parent . parent ) &&
166
166
ts . isObjectBindingPattern ( node . parent . name ) ;
167
167
168
- // Pattern: for (const x in NS) { }
169
- // Pattern: for (const x of NS) { }
170
- export const isIteratingObject = ( node : ts . Node ) =>
171
- node . parent && ( ts . isForInStatement ( node . parent ) || ts . isForOfStatement ( node . parent ) ) ;
172
-
173
168
export const getDestructuredIds = ( name : ts . ObjectBindingPattern ) =>
174
169
name . elements . map ( element => element . name . getText ( ) ) ;
175
170
@@ -192,6 +187,9 @@ export const isObjectEnumerationCallExpressionArgument = (node: ts.Identifier) =
192
187
node . parent . expression . expression . escapedText === 'Object' &&
193
188
objectEnumerationMethods . has ( String ( node . parent . expression . name . escapedText ) ) ;
194
189
190
+ export const isInForIteration = ( node : ts . Node ) =>
191
+ node . parent && ( ts . isForInStatement ( node . parent ) || ts . isForOfStatement ( node . parent ) ) ;
192
+
195
193
export const isTopLevel = ( node : ts . Node ) =>
196
194
ts . isSourceFile ( node . parent ) || ( node . parent && ts . isSourceFile ( node . parent . parent ) ) ;
197
195
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import {
22
22
isConsiderReferencedNS ,
23
23
isDestructuring ,
24
24
isImportSpecifier ,
25
- isIteratingObject ,
25
+ isInForIteration ,
26
26
isObjectEnumerationCallExpressionArgument ,
27
27
isReferencedInExport ,
28
28
} from './ast-helpers.js' ;
@@ -354,7 +354,7 @@ const getImportsAndExports = (
354
354
} else if ( isObjectEnumerationCallExpressionArgument ( node ) ) {
355
355
// Pattern: Object.keys(NS)
356
356
imports . refs . add ( id ) ;
357
- } else if ( isIteratingObject ( node ) ) {
357
+ } else if ( isInForIteration ( node ) ) {
358
358
// Pattern: for (const x in NS) { }
359
359
// Pattern: for (const x of NS) { }
360
360
imports . refs . add ( id ) ;
File renamed without changes.
You can’t perform that action at this time.
0 commit comments