【发布时间】:2019-04-17 02:48:05
【问题描述】:
我在我的 Angular 6 项目中使用 SonarQube(版本 6.7.5),并希望处理以下代码异味:
“模块‘src’未在 package.json 中列为依赖项”
整个项目中有很多导入,例如“import ... from ‘src/app/...’;” 我在 tslint.json 中添加了以下规则:
“no-implicit-dependencies”: [true, [“src”, “app”]]
但没有成功。 我怎样才能最好地解决这种代码异味?
【问题讨论】:
-
只是忽略它是一种选择吗?我认为当你以某种方式解决它时,代码质量不会提高。
-
通常,您会使用相对路径进行导入,例如
import … from './…'