簡體   English   中英

Reactjs typescript 禁用特定文件夾的 linting

[英]Reactjs typescript disable linting for a specific folder

我將 charting_library 用於 react/typescript 項目。 由於 linting,我收到了這些編譯錯誤,CL 建議忽略這些 linting 問題。

在此處輸入圖像描述

這是我的 tsconfig.json 文件

    {
  "compilerOptions": {
    "baseUrl": "src",
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "downlevelIteration": true,
    "allowJs": false,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "types":[
      "node",
      "webpack-env" // here
    ]
  },
  "include": [
    "src",
    "**/*.ts",
    "**/*.tsx",
    "types/*.d.ts",
    "**/*.d.ts"
  ]
}

我添加了一個名為 tsconfig.eslint.json 的單獨文件,並嘗試像這樣放置文件夾路徑

{
    "extends": "./tsconfig.json",
    "exclude": ["./src/pages/instuments/technicalAnalysis/charting_library/*js"]
  }

但這並不排除該文件夾。 如何從 linting 中排除 charting_libray 文件夾?

我不確定tsconfig.eslint.json文件。

由於您希望eslint忽略該文件夾,因此您應該在項目的根目錄中創建一個.eslintignore

.eslintignore文件中,添加/追加這一行:

src/pages/instuments/technicalAnalysis/charting_library/**/*.js

**/*.js部分匹配charting_library和該文件夾的子文件夾中的所有.js文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM