Skip to content

Latest commit

 

History

History
37 lines (18 loc) · 1.32 KB

README.md

File metadata and controls

37 lines (18 loc) · 1.32 KB

Circular Dependencies Trainer

This repo presents 3 snippets of code containing circular dependencies. The goal is to solve each of these circular dependencies.

How to spot a circular dependency

Running yarn test-circular enables to identify circular dependencies.

If you are not familiar with dependency-cruiser, feel free to have a look at their documentation: https://github.com/sverweij/dependency-cruiser

Exercises

Exercise 1

This is an example of files in a common folder importing each other through the index.ts file of the folder

image

Exercise 2

Here, the circular dependency is due to a poor file architecture as files and variable instantiations are not splitted accordingly to the business logic.

image

Exercise 3

This is a more complex variant of Exercise 2.

image

Solution

A PR containing the solutions of the 3 examples is opened. Each commit of the PR corresponds to the solution to one example.