忽略特定eslint插件中的特定文件 [英] Ignore specific file from specific eslint plugin
问题描述
我使用的 eslint-plugin-tsdoc
效果很好,除了不需要整理文件的文件外,例如,任何使用apidoc而不是tsdoc注释样式的api路由./p>
在运行任何棉绒时都会导致错误.无论如何,我可以忽略 eslint-plugin-tsdoc
的文件吗?我不想完全忽略eslint的文件,因为我仍然需要检查打字稿.
您可以在.eslintrc文件中使用override属性.使用配置文件来禁用一组文件
由于 eslint-plugin-tsdoc
仅具有一条规则 tsdoc/syntax
.
您需要将此文件添加到您的 .eslintrc
文件中.
{" rules":{...},替代":[{文件":["* .test.ts","/src/demo.ts"],规则":{"tsdoc/语法":关闭";}}]}
因此,在上面的示例中,它将对所有以 .test.ts
结尾的文件和文件/src/demo.ts
禁用该规则,并将此规则应用于其余文件.
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.
This is causing errors when running any linting. Is there anyway that I can ignore files for the eslint-plugin-tsdoc
? I don’t want to ignore the file altogether by eslint because I still need the typescript to be checked.
You can use the override property in .eslintrc file. Using configuration files to disable for a group of files
Since eslint-plugin-tsdoc
only has one rule tsdoc/syntax
.
You need to add this to your .eslintrc
file.
{
"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.
这篇关于忽略特定eslint插件中的特定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!