den*_*dog 5 typescript eslint visual-studio-code monorepo typescript-eslint
我有以下项目结构:
/root
/serviceA
/serviceB
/serviceC
/serviceD
Run Code Online (Sandbox Code Playgroud)
并非所有服务都基于打字稿/节点,因此我想避免将 tsconfig 添加到根目录中。每个服务都设置为一个完整的单元,具有自己的 eslint、ts 安装和自己的配置。
ts
我打开 VScode 的任何服务都显示以下错误:
Parsing error: Cannot read file '/users/{me}/dev/{root}/tsconfig.json'.
Run Code Online (Sandbox Code Playgroud)
这是正确的,因为没有这样的文件,那么如何强制 vscode & eslint 使用单个服务配置文件?
小智 8
使用以下命令编辑您的.eslintrc
文件:
module.exports = {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
Run Code Online (Sandbox Code Playgroud)
来源:https : //github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-488538828
.eslintrc
您可以将路径设置为tsconfig.json
.
parserOptions : {\n project: \'./tsconfig.json\',\n},\n
Run Code Online (Sandbox Code Playgroud)\n这里\xe2\x80\x99s是一个例子,它只是为ts文件设置的
\n\n 归档时间: |
|
查看次数: |
3718 次 |
最近记录: |