简体   繁体   English

Eslint:如何禁用对给定文件的所有检查?

[英]Eslint: How to disable all checking for given file(s)?

I have some vendor JS libraries in a project, and I want to disable all Eslint checking for these files. 我在项目中有一些供应商JS库,并且我想禁用所有对这些文件的Eslint检查。

I've looked at the documentation and it describes how to disable checking via inline comments, eg 我看过文档 ,它描述了如何通过内联注释禁用检查,例如

/* eslint-disable */

..but I would rather not touch the files, and configure Eslint via eg a local .eslintrc file. ..但是我不想碰文件,而是通过本地.eslintrc文件配置Eslint。 How to disable all checking as above, via such a file, is not described in the documentation. 文档中没有描述如何通过这样的文件禁用上述所有检查。

Is it possible, and if so what would the .eslintrc file look like? 有可能,如果是这样,.eslintrc文件将是什么样? It would be OK to disable ALL checking in a given directory. 可以禁用给定目录中的所有检查。

You can look at this answer from a similar question. 您可以从类似的问题中查看答案。

Basically you should add a .eslintignore file to your project's root directory and specify the files and directories you want to ignore like so: 基本上,您应该在项目的根目录中添加.eslintignore文件,并指定要忽略的文件和目录,如下所示:

.eslintignore file: .eslintignore文件:

build/*.js
config/*.js
bower_components/foo/*.js

Also look at this section from the official ESLint docs 另请参阅ESLint官方文档中的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM