本文介绍了禁用文件夹的夹板规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以禁用文件夹的特定规则?例如,我不想在 test
文件夹中的所有测试文件中都需要JSDoc注释。有办法吗?
Is there a way to disable specific rules for a folder? For example, I don't want to have required JSDoc comments for all my test files in the test
folder. Is there a way to do this?
推荐答案
要忽略eslint规则中的某些文件夹,我们可以创建文件 .eslintignore
放在根目录中,然后在其中添加我们要忽略的文件夹的路径(与 .gitignore
相同)。
To ignore some folder from eslint rules we could create the file .eslintignore
in root directory and add there the path to the folder we want omit (the same way as for .gitignore
).
这是:
# path/to/project/root/.eslintignore
# /node_modules/* and /bower_components/* in the project root are ignored by default
# Ignore built files except build/index.js
build/*
!build/index.js
这篇关于禁用文件夹的夹板规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!