[英]Ignore specific file from specific eslint plugin
I am using eslint-plugin-tsdoc
which works well, except for files where I don't require the linting, for instance, any api routes which use apidoc instead of tsdoc commenting styles.我正在使用运行良好
eslint-plugin-tsdoc
,除了我不需要 linting 的文件,例如,任何使用 apidoc 而不是 tsdoc 注释 styles 的 api 路由。
This is causing errors when running any linting.这会在运行任何 linting 时导致错误。 Is there anyway that I can ignore files for the
eslint-plugin-tsdoc
?无论如何我可以忽略
eslint-plugin-tsdoc
文件吗? I don't want to ignore the file altogether by eslint because I still need the typescript to be checked.我不想通过 eslint 完全忽略该文件,因为我仍然需要检查 typescript。
You can use the override property in.eslintrc file.您可以使用 .eslintrc 文件中的覆盖属性。 Using configuration files to disable for a group of files
使用配置文件禁用一组文件
Since eslint-plugin-tsdoc
only has one rule tsdoc/syntax
.由于
eslint-plugin-tsdoc
只有一个规则tsdoc/syntax
。
You need to add this to your .eslintrc
file.您需要将此添加到您的
.eslintrc
文件中。
{
"rules": {...},
"overrides": [
{
"files": ["*.test.ts", "/src/demo.ts"],
"rules": {
"tsdoc/syntax": "off"
}
}
]
}
So in the above example it will disable the rule for all files ending with .test.ts
and the file /src/demo.ts
and apply this rule for rest of the files.因此,在上面的示例中,它将禁用所有以
.test.ts
和文件/src/demo.ts
结尾的文件的规则,并将此规则应用于文件的 rest。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.