Skip to content

Commit

Permalink
Merge pull request #31 from Bitspark/master
Browse files Browse the repository at this point in the history
Fix "RangeError: Maximum call stack size exceeded"
  • Loading branch information
bcherny committed Mar 2, 2019
2 parents 4756e5f + df2f41f commit 45fcb1c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions noCircularImportsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ function walk(context: Lint.WalkContext<Options>) {
if (!node.moduleSpecifier) {
return
}
if (!ts.isSourceFile(node.parent)) {
return
}
const fileName = node.parent.fileName

if (!ts.isStringLiteral(node.moduleSpecifier)) {
Expand Down Expand Up @@ -150,8 +153,8 @@ function walk(context: Lint.WalkContext<Options>) {
for (const imp of Array.from(moduleImport.keys())) {
const c = getAllCycles(imp, accumulator.concat(moduleName), iterationDepth + 1)

if (c.length)
all.push(...c)
for (const cycle of c)
all.push(cycle)
}

return all
Expand Down

0 comments on commit 45fcb1c

Please sign in to comment.