2

如何在 typescript 中为不同的 eslintrc 和 tsconfig 设置 eslint 我有以下用于编译 eslint 的结构和测试命令。每当我运行tsc时,它都会使用被测路径别名从文件中生成所有错误,但从编辑器(webstorm/vscode)路径中生成的所有错误都是正确的,没有错误。我该如何配置,所以当我运行 compilt 命令时,它可以读取不同的 tsconfig.json 而不仅仅是从root/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/*"],
    }
  }
}

4

0 回答 0