Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable eslint for all files in directory and subdirectories

Tags:

eslint

I have some files that are in a certain folder and those files are from a vendor so I cannot control them. I would like to disable eslint for all the files in that directory and all subfolders.

like image 246
David Choi Avatar asked Apr 03 '17 21:04

David Choi


People also ask

How do I disable ESLint for multiple lines?

For those converting eslint-disable-next-line to eslint-disable (for multiple lines), remember two things. 1. /* */ instead of // 2. It's eslint-disable and not eslint-disable-next-line . Just reiterating coz I did the same and had to search many more things due to the 2nd point.

How do I disable ESLint function?

You can also disable all ESLint rules by putting /* eslint-disable */ at the top of a file.

How do I make ESLint folder ignore?

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 ).


2 Answers

You can add a .eslintignore in project root directory, and use it the same as .gitignore, .npmignore, etc..

When it comes to ignoring multiple files at the same time, we can use **.

For example: src/** means ignore all files in [root]/src.

like image 63
David Guan Avatar answered Sep 29 '22 18:09

David Guan


In ESLint 6.7.0+ use "ignorePatterns": [].

As of ESLint 6.7.0, you can now pass an Array of paths to a top-level "ignorePatterns" attribute in your ESLint config in .eslintrc.json:

{   // The rest of your ESLint config...   "ignorePatterns": [ "gists/", "vendor/" ]  } 

You can read the release announcement from November 2019 here.

like image 26
Joshua Pinter Avatar answered Sep 29 '22 20:09

Joshua Pinter