如何在打字稿中为不同的eslintrc和tsconfig设置eslint
我具有以下用于编译eslint的结构和测试命令。每当我运行tsc
时,它都会使用被测路径别名从文件生成所有错误,但从编辑器(webstorm / vscode)路径生成的所有错误均正确无误。如何配置,以便在运行compilt命令时它不仅可以从root/tsconfig.json
读取不同的tsconfig.json。
- root
|_tsconfig.json
|_.eslintrc.json
|_test
|_tsconfig.json
|_.eslintrc.json
|_abc
# root/tsconfig.json
{
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"@uc/eslint-config-react",
"prettier",
"prettier/react",
"prettier/@typescript-eslint"
],
"plugins": ["react-hooks", "@typescript-eslint"],
"parser": "@typescript-eslint/parser",
}
# root/test/tsconfig.json
{
"compilerOptions": {
"strict": true,
"target": "es6",
"module": "commonjs",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"types": ["cypress", "chai"],
"baseUrl": ".",
"paths": {
"@abc/*": ["./abc/*"],
}
}
}