![](/img/trans.png)
[英]How to run typescript-eslint on .ts files and eslint on .js files in the same project in VSCode
[英]How to run eslint rules on just typescript files?
我有一個包含大量 .js 和 .ts/.tsx 文件的代碼庫。 我想在整個代碼庫上運行一些規則,在 typescript 個文件上運行一些規則。
我怎樣才能以最好的方式實現這一目標?
具體來說,我想要規則: "react/prop-types": "error",
只運行 on.ts 文件
但它只給出了一個error
選項,所以不知道如何說 just.ts 這個?
您可以在 .eslintrc 文件中使用覆蓋選項:
{
rules: {
// all your general rules that apply to everyone
},
overrides: {
files: ['*.ts', '*.tsx'],
rules: {
// rules you want for ts/tsx files
react/prop-types: 'error',
},
},
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.