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.

ESLint throwing circular dependency issues (what feels) at random

See original GitHub issue

Current Behavior

So I’ve been trying out nx the past few days and so far it looks very promising!

Now I’ve been playing around with different structures and the issue seems to be returning, so not sure whether it’s a bug or just me doing something wrong. It seems to be at random that ESLint is throwing circular dependencies:

Circular dependency between "api-core-feature" and "api" detected: api-core-feature -> api -> api-core-feature

Circular file chain:
- libs/api/core/feature/src/lib/api-core-feature.module.ts
- apps/api/src/app/app.module.ts (eslint@nrwl/nx/enforce-module-boundaries)

Often it also throws: imports of apps are forbidden (nx-enforce-module-boundaries), but these seem to go away automatically.

Everything works fine, running the linter also shows no issues, and neither does creating a build. I’ve no boundaries setup in ESLint and there are no tags added to the libs.

eslint-err

dep-graph

Expected Behavior

To only throw actual circular deps.

Steps to Reproduce

Keeps happening at random, but it’s mainly happening to the stuff I import in the ApiCoreFeatureModule. Although, It’s also happened in other spots.

Environment

MacOS on both VSCode and WebStorm.

node 16.13.1 npm 8.1.2

"@nrwl/angular": "13.4.1",
"@nrwl/cli": "13.4.1",
"@nrwl/cypress": "13.4.1",
"@nrwl/eslint-plugin-nx": "13.4.1",
"@nrwl/jest": "13.4.1",
"@nrwl/linter": "13.4.1",
"@nrwl/nest": "^13.4.1",
"@nrwl/node": "13.4.1",
"@nrwl/tao": "13.4.1",
"@nrwl/workspace": "13.4.1"

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ivibecommented, Jan 10, 2022

I have the same issue. My IDE is VS Code. Apparently it’s a cache issue as mentioned by @demisx . My workaround is to force linting across entire monorepo

nx run-many --target=lint --all --parallel --force

and then just to restart IDE.

0reactions
meeroslavcommented, Feb 10, 2022

@BOBRIWE I will look into this issue as soon as possible. Sorry for the delay.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix nasty circular dependency issues once and for all in ...
First, this is ugly and doesn't scale. In a large code base, this will result in moving imports randomly around until stuff just...
Read more >
How to Eliminate Circular Dependencies from Your JavaScript ...
Circular dependencies are usually an indication of bad code design, and they should be refactored and removed if at all possible.
Read more >
Resolving the circular dependency issue I have between two ...
The problem is, Manhunt and MinigameManager are in two separate plugins meaning this current setup requires IntelliJ to add dependencies for ...
Read more >
Don't make the same mistake I did. Avoid circular ... - Reddit
Classes can be broken up so that the part that actually requires a circular dependency is in a different file that isn't referred...
Read more >
How to solve this basic ES6-module circular dependency ...
Then finally, the C module is evaluated last. At the end of the C module, you see that it calls setUpA and setUpB...
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