【发布时间】:2020-06-02 19:42:40
【问题描述】:
当我更新 nx.json 中的项目标签时,TSLint 似乎没有意识到标签已更改,并且即使违反了依赖项,也会检查并构建项目。
示例
目前我的 nx.json 文件看起来像
{
"npmScope": "patient-engagement",
"implicitDependencies": {
"package.json": "*",
"tsconfig.json": "*",
"nx.json": "*"
},
"projects": {
"hep": {
"tags": ["scope:hep", "compatibility:ie10"],
"implicitDependencies": []
},
"mb-ui": {
"tags": ["scope:shared", "compatibility:ie10"],
"implicitDependencies": []
},
"utils": {
"tags": ["scope:shared", "compatibility:ie10"],
"implicitDependencies": []
}
}
}
我的根 tslint.json 包括:
"nx-enforce-module-boundaries": [
true,
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "scope:hep",
"onlyDependOnLibsWithTags": [
"scope:hep",
"scope:shared"
]
},
{
"sourceTag": "compatibility:ie10",
"onlyDependOnLibsWithTags": [
"compatibility:ie10"
]
},
{
"sourceTag": "scope:shared",
"onlyDependOnLibsWithTags": [
"scope:shared"
]
}
]
}
],
当我运行 ng lint hep 时,这会按预期通过 linting。
但是,如果我编辑 nx.json 中的标签,linter 不会显示任何错误。例如,如果我将 nx.json 修改为如下所示(从库中删除标签),它仍然会 lints 并构建而不会出现任何错误。
{
"npmScope": "patient-engagement",
"implicitDependencies": {
"package.json": "*",
"tsconfig.json": "*",
"nx.json": "*"
},
"projects": {
"hep": {
"tags": ["scope:hep", "compatibility:ie10"],
"implicitDependencies": []
},
"mb-ui": {
"tags": [],
"implicitDependencies": []
},
"utils": {
"tags": [],
"implicitDependencies": []
}
}
}
如果有用,当我更新 tslint.json 中的规则时,linter 确实会抛出错误,但我希望它也能确认对 nx.json 的更改。
有没有办法让 linter 在更新 nx.json 中的标签时显示错误?
【问题讨论】: