[英]Disable TypeScript Inline for an individual file
我有 TS 運行時出現錯誤,我想忽略、編譯,但在使用時
/* tslint:disable */
運行我的構建時它仍然運行。
hutber@hutber:/var/www/bp/frontend$ git commit -m"feat: add basic foundations for theme & breadcrums"
husky > pre-commit (node v14.14.0)
$ tsc
components/Layouts/Breadcrums/index.tsx:17:13 - error TS2322: Type 'string' is not assignable to type 'HTMLCollection'.
17 {a}
~~~
在您的tslint.json
,您可以嘗試排除該文件:
{
"extends": "tslint:latest",
"linterOptions": {
"exclude": [
"bin",
"<path to your excluded file here>"
]
}
}
或者將您的文件添加到.eslintignore
,如果您有的話。
我認為 TSLint 已被棄用,需要使用例如// eslint-disable-next-line @typescript-eslint/<type of error>
。 但是,我並不完全了解您的配置,因此這可能需要進行微調。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.