noaignite / create-ignite-app

Boilerplate for React with Next.js and MUI
17 stars 2 forks source link

`eslint-typescript`: Dependency cycle #89

Closed adamsoderstrom closed 1 year ago

adamsoderstrom commented 1 year ago

Steps to reproduce

  1. Install create-ignite-app - npx @noaignite/create-app my-app
  2. Remove yarn.lock file - rm yarn.lock
  3. Install dependencies - yarn install
  4. Build the Next.js application - yarn build

You partially get the following response:

...
yarn run v1.22.17
$ next build

Failed to compile.

./src/blocks/ErrorBlock/ErrorBlock.js
5:1  Error: Dependency cycle via ./Page:5=>./Page:1=>~/blocks:5=>./ErrorBlock:4  import/no-cycle

./src/blocks/ErrorBlock/index.js
1:1  Error: Dependency cycle via ~/containers:5=>./Page:5=>./Page:1=>~/blocks:5  import/no-cycle

./src/blocks/Hero/Hero.js
5:1  Error: Dependency cycle via ./Page:5=>./Page:1=>~/blocks:5=>./Hero:5  import/no-cycle

./src/blocks/Hero/index.js
1:1  Error: Dependency cycle via ~/containers:5=>./Page:5=>./Page:1=>~/blocks:5  import/no-cycle

./src/blocks/index.js
4:41  Error: Dependency cycle via ./ErrorBlock:1=>~/containers:5=>./Page:5=>./Page:1  import/no-cycle

./src/containers/Page/Page.js
5:1  Error: Dependency cycle via ./ErrorBlock:4=>./ErrorBlock:1=>~/containers:5=>./Page:5  import/no-cycle

./src/containers/Page/index.js
1:1  Error: Dependency cycle via ~/blocks:5=>./ErrorBlock:4=>./ErrorBlock:1=>~/containers:5  import/no-cycle

./src/containers/index.js
5:1  Error: Dependency cycle via ./Page:1=>~/blocks:5=>./ErrorBlock:4=>./ErrorBlock:1  import/no-cycle

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Dependency cycle

The commit causing the lint error (retrieved via git bisect): efbde14ee7

As i understand it, dependency cycle looks something like this:

graph TD
    blocks
    ErrorBlock
    Hero
    Page
    RouterLink

    containers --> RouterLink
    containers --> Page
    Page --> |Here's the origin of the dependency cycle|blocks
    blocks --> Hero
    blocks --> ErrorBlock
    Hero --> containers
    ErrorBlock --> containers
adamsoderstrom commented 1 year ago

I think it's worth noting that it's weird that this hasn't appeared earlier..? 🤔

maeertin commented 1 year ago

Fixed by https://github.com/noaignite/create-ignite-app/pull/91