Skip to content

Commit

Permalink
Avoid flow imports in no-cycle rule
Browse files Browse the repository at this point in the history
  • Loading branch information
claramunt authored and ljharb committed Jun 6, 2019
1 parent 15e5c61 commit 52dbd0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ExportMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ ExportMap.parse = function (path, content, context) {
const getter = thunkFor(p, context)
m.imports.set(p, {
getter,
importKind: declaration.importKind,
source: { // capturing actual node reference holds full AST in memory!
value: declaration.source.value,
loc: declaration.source.loc,
Expand Down
3 changes: 2 additions & 1 deletion src/rules/no-cycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ module.exports = {
if (traversed.has(m.path)) return
traversed.add(m.path)

for (let [path, { getter, source }] of m.imports) {
for (let [path, { getter, importKind, source }] of m.imports) {
if (importKind === 'type') continue
if (path === myPath) return true
if (traversed.has(path)) continue
if (route.length + 1 < maxDepth) {
Expand Down

0 comments on commit 52dbd0b

Please sign in to comment.