禁用文件夹的夹板规则

问题描述:

是否可以禁用文件夹的特定规则?例如,我不想在 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