question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update to 10.2.0 results a huge amount of circular dependencies lint errors

See original GitHub issue

Current Behavior

Circular dependencies suddenly occur after update to 10.2.0

Expected Behavior

Circular dependencies should not suddenly occur after update to 10.2.0. No issues on 10.1.0.

Steps to Reproduce

I’m afraid I can’t share my repo. But I have 2 libraries:

shared/components shared/services

shared/components imports from shared/services, but shared/services doesn’t import shared/components. I have double checked this.

Still after updating to 10.2.0 I suddenly get:

ERROR: 3:1 nx-enforce-module-boundaries Circular dependency between “shared-components” and “shared-services” detected.

This is just one example, I have loads of them.

I have opened up the runtime-lint-utils and added some console logging and for all I can conclude is that i goes looking up any other libs containing imports of shared-services and if those other libs are also importing shared-components, it resolves to true.

there is a funny twist in the code I noticed also:

export function isCircular(
  graph: ProjectGraph,
  sourceProject: ProjectGraphNode,
  targetProject: ProjectGraphNode
): boolean {
  if (!graph.nodes[targetProject.name]) return false;
  return isDependingOn(graph, targetProject.name, sourceProject.name);
}

function isDependingOn(
  graph: ProjectGraph,
  sourceProjectName: string,
  targetProjectName: string,
  done: { [projectName: string]: boolean } = {}
): 

see how targetProject and sourceProject are flipped as arguments?

Environment

nx : Not Found @nrwl/angular : 10.2.0 @nrwl/cli : 10.2.0 @nrwl/cypress : 10.2.0 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 10.2.0 @nrwl/linter : Not Found @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : Not Found @nrwl/schematics : Not Found @nrwl/tao : 10.2.0 @nrwl/web : Not Found @nrwl/workspace : 10.2.0 typescript : 3.9.7

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
evtkcommented, Sep 23, 2020

YES! I can report back that the issues are gone. Though I had to do a second run after fixing imports from '..' as well. But after this, the linting errors have disappeared!

I should be nice if we could have some additional linting that will throw lint errors when importing in this way ('..' and '.')!

2reactions
x87commented, Sep 23, 2020

@FrozenPandaz ok, the issue is that this utility function https://github.com/nrwl/nx/blob/e9393805c175e9b7e5a94aca71fa654970ccb802/packages/workspace/src/utils/fileutils.ts#L114 does not recognize '.' as a valid relative path, resulting in broken logic starting here https://github.com/nrwl/nx/blob/be921083553bea0cbf6f87f3679489ce924917bf/packages/workspace/src/core/target-project-locator.ts#L50

'.' must not be a normalizedImportExpr.

So I think this should be the only use case that is left missing. @EvtK can you confirm if your code base has imports from '.'?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Sheets Circular Dependency Detected Error [Easy Fix]
Learn step-by-step how to quickly and easily fix the circular dependency detected error that can occur in Google Sheets.
Read more >
NG0200: Circular dependency in DI detected while ... - Angular
Break this loop (or circle) of dependency to resolve this error. This most commonly means removing or refactoring the dependencies to not be...
Read more >
Spring boot application fails to start after upgrading to 2.6.0 ...
java - Spring boot application fails to start after upgrading to 2.6. 0 due to circular dependency[ unresolvable circular reference] - Stack ...
Read more >
How to Analyze Circular Dependencies in ES6? - Railsware
It is caused by circular dependencies that cannot be resolved synchronously by webpack. One is undefined, hence the error.
Read more >
`apt --fix-broken` is broken (`uim` has circular dependencies)
I edited /var/lib/dpkg/status and removed all references to uim and anthy . Then I ran: sudo apt update && sudo apt upgrade.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found