我有以下项目结构:
/root
/serviceA
/serviceB
/serviceC
/serviceD
并非所有服务都基于 typescript /节点,因此我想避免将 tsconfig 添加到根目录中。每个服务都设置为一个完整的单元,具有自己的 eslint、ts 安装和自己的配置。任意
ts
我打开 VScode 的服务显示以下错误:Parsing error: Cannot read file '/users/{me}/dev/{root}/tsconfig.json'.
这是正确的,因为没有这样的文件,那么如何强制 vscode & eslint 使用单个服务配置文件?
最佳答案
编辑您的 .eslintrc
文件:
module.exports = {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
来源:https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-488538828
关于Monorepo 中的 typescript eslint tsconfig 解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63355118/