[当我更新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
时,按预期通过了棉绒。
但是,如果我在nx.json中编辑标签,则短绒不会显示任何错误。例如,如果我修改nx.json使其看起来像这样(从库中删除标签),它仍然会掉线并构建而没有任何错误。
{
"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中的规则时,lint确实会抛出错误,但我希望它也确认对nx.json的更改。
有没有一种方法可以使短绒猫在nx.json中的标签更新时显示错误?
也可能是VS Code的缓存导致问题
在更改tslint.json或tsconfig.json文件之前,您可能需要重新启动Typescript服务。
ctrl + shift + p and then Typescript: Restart TS Server
Nx在生成的文件中缓存一堆有关依赖项的信息:/dist/nxdeps.json
您可以简单地删除此文件以立即查看对nx.json的更改。