bcherny/tslint-no-circular-imports

Problem about the weird presentation of circular imports

Open

#28 opened on Oct 9, 2018

View on GitHub
 (5 comments) (0 reactions) (0 assignees)TypeScript (11 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (90 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

I'm currently curious about the warning texts problem , which I'm not sure whether original feature design or not. The situation code could clone from the commit: https://github.com/chigix/mandoc/tree/8fb20574682c5335ff90eea4761c82d1a4021dfe

after clone and checkout to commit: 8fb20574682c5335ff90eea4761c82d1a4021dfe, run:

npm install
npm run ts-lint

> tslint -c tslint.json --project tsconfig/tsconfig.base.json "src/**/*.ts"

no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.

ERROR: C:/Users/chigi/Projects/mandoc/src/bin/mandoc.ts[17, 1]: circular import detected: mandoc.ts -> template.config.ts -> template.stream.ts -> template.helper.ts -> mandoc.ts
ERROR: C:/Users/chigi/Projects/mandoc/src/index.ts[1, 1]: circular import detected: index.ts -> template.stream.ts -> template.helper.ts -> index.ts
....

The problem is about the circulation result. Take the first error for instance, the real circulation should be:

mandoc.ts -> template.config.ts -> template.stream.ts -> template.helper.ts -> template.stream.ts

rather than:

mandoc.ts -> template.config.ts -> template.stream.ts -> template.helper.ts -> mandoc.ts

, which made me confused initially because I could not find any import from mandoc.ts in template.helper.ts, as warned.

Although it is not a fatal error, I still want to ask and confirm the original design.

Contributor guide