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

- 4,180
- 1
- 25
- 32
-
I think you're in the right direction, but creating an empty .eslintignore file and placing it in the directory where the scripts are located is not working for me. Is there something else that is needed? Does the file need to contain something? – David Choi Apr 04 '17 at 14:50
-
1David I read the docs and created the file at the root of my app, where the eslintrc file is located at. And I added this line ./src/wijmo/*, which is where the files I want eslint to ignore are at. But its still linting some of the subfolders. Is there a syntax to indicate all files in all subfolders in one line? – David Choi Apr 04 '17 at 15:04
-
Had to add a path to each subfolder, but it did work. – David Choi Apr 04 '17 at 15:17
-
8The `**` can be left off the end, as specifying a directory disables subdirectories by default; `src/` is sufficient. – shamsup Aug 02 '17 at 15:12
-
Hopw woudl you define an exception from `src/` within `.eslintignore`? – Ini Sep 02 '19 at 08:49
-
I had to explicitly exclude all `eslintrc.js` files: `**/.eslintrc.js` – TmTron Jan 27 '21 at 17:56
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.

- 45,245
- 23
- 243
- 245
I needed a flag to temporarily exclude|disable|ignore a directory. I tried eslint --help | grep exclude
to no avail.
Then, I'd queried Google for eslint exclude directory and the first SO result pointed me to Disable eslint rules for folder and my answer was not found there, and not here either, so maybe someone else is searching for "exclude", which in this context is fully swappable with "disable".
Finally, in the ESLint CLI Docs I found these:
--ignore-path
--ignore-pattern
--no-ignore
I hope that helps somebody (who might think of a quick SO hit before... documentation).

- 2,488
- 26
- 23
-
This fails to answer the question - it doesn't actually demonstrate how to ignore "all files in directory and subdirectories" which is what the OP asked for. Linking to docs is good but posting examples that clearly answer the question is what an answer should aim for. If you just want to link the docs, that would be a useful comment on the OP. – GrayedFox Sep 04 '19 at 11:12
-
@GrayedFox it absolutely answers the question. I give specific flags and where I found them because the accepted answer didn't answer the question... I'd searched for this question and ended up having to find my own answer, so I shared it. How weird to take time to be snooty when I aim to help others stuck like I was. I also explained how I'd investigated to find the ANSWER for others that might be stuck there. What a weird first ever down vote. – Neil Gaetano Lindberg Sep 04 '19 at 20:24
-
2It doesn't actually demonstrate _how_ to ignore all files in a directory and subdirectories since your answer doesn't give an example pattern, such as `eslint . --ignore-pattern path/to/ignore/**`, neither does it explain that you can use a `.eslintignore` file inside your root (or other directories) to achieve the desired behaviour. Your answer just tells us what you tried, lists some valid eslint flags, and then links to docs. Question was not "what are some flags that I could use to ignore files with eslint" - then your answer would be perfect – GrayedFox Sep 05 '19 at 12:55