[英]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.