当我在nx.json中更新项目标记时,TSLint似乎不知道标签已经改变了,而lints和builds项目,即使违背了依赖关系。
示例
当前,我的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中编辑标记,链接器就不会显示任何错误。例如,如果我将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的更改。
在更新nx.json中的标记时,有什么方法可以让链接器显示错误呢?
发布于 2020-02-18 23:29:40
Nx缓存一堆有关生成文件中的依赖项的信息:/dist/nxdeps.json
您只需删除此文件即可立即看到对nx.json的更改。
发布于 2020-02-21 06:43:19
它也可能是VS代码的缓存,导致问题
在对tslint.json或tsconfig.json文件进行更改之前,您可能需要重新启动类型记录服务。
ctrl + shift + p and then Typescript: Restart TS Server
发布于 2021-12-15 14:04:07
在Webstorm中,重新启动类型记录服务没有帮助,但是重新启动IDE会有所帮助(类似于索引文件)。
在我的例子中,在编辑nx.json时,我正在执行这样的步骤:
删除dir node_modules/.cache/nx
nx lint (将生成新缓存)
https://stackoverflow.com/questions/60286775
复制相似问题