eslint/eslint — pull request #1592 by MikeMcl (2014-12-18 19:45:37+00:00)
Title: New: Configuration by package.json (fixes #698)

This is an alternative to my other pull request for this issue.
It is the same as the other, and equally ready to ship, except that lib/file-finder has been more heavily changed.

The basic search and cache logic is the same but the `findInDirectory` method has ben replaced with two methods: `findInDirectoryOrParent` and `findAllInDirectoryAndParents`.

At the moment to find local config files `getLocalConfig` calls `Config.prototype.findLocalConfigFile` which calls `findInDirectory` which returns one (or in my other pull request one or two) files at a time, and it calls itself recursively to search each higher directory.

In this pull request, `getLocalConfig` calls `Config.prototype.findLocalConfigFile` which calls a `findAllInDirectoryAndParents` method which returns all the local config files in one go and without recursion. And there is a separate method when only one file needs to be found, `findInDirectoryOrParent` which is used to find `.eslintignore` files.

This new approach reduces the number of function calls and caching of arrays significantly, and is cleaner regarding return values (e.g.the `return ignoreFileFinder.findInDirectory()[0] || false;` in lib/ignored-paths.js is no longer necessary).

I also added a tests/lib/file-finder.js with 100% coverage for the new version of lib/file-finder.js.