eslint/eslint — pull request #1572 by MikeMcl (2014-12-12 17:30:01+00:00)
Title: New: Configuration via package.json (fixes #698)

> In terms of behavior, I think it should act like a .eslintrc would in the same directory.

Yes.

> The only questions in my mind;
> How would ESLint know to look in package.json? Would it always do so by default?

I added a `usePackageJson` option which follows the behaviour of `useEslintrc`, and so is turned on by default.

> What is the expectation if there is config in both package.json and .eslintrc in the same directory?

>There is a hierarchy followed by JSHint and JCSC for this. The package.json would be looked for first, and if found with ESLint config used. Failing that the .eslintrcwould be looked for and used if available.

I chose to instead use both, with the .eslintrc file having the higher precendence. To me, that seems more consistent with current behaviour and more flexible.

> We will stick with eslintConfig to match other tools doing similar things.

I used `eslint` as the field name to look for in the package.json.

The main code changes are to lib/config.js and I needed to change the behaviour of lib/file-finder.js so that now a `FileFinder` can accept a variable number of files to find and returns an array of files found or null if none are.

I'm looking for feedback in terms of questions about the new behaviour, changes that need to be made, preferences for the field name etc.

There are further tests still to be added to tests/lib/config.js and I will update this request with them presently.