Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Improve package.json eslintConfig support #848

Merged
merged 2 commits into from
Mar 14, 2017
Merged

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented Mar 14, 2017

Description

This PR solves a few edge cases around using eslintConfig properties within package.json files:

It does this by searching every directory for a package.json in addition to the other .eslintrc.*-style config files. If we find a .eslintrc file, then we'll just return that off the bat, since they are checked first (they come first in the array we provide to findCached). If we find a package.json file, we will check if it has an eslintConfig property. If so, we're done. If not, we will continue looking in parent folders and repeating the process.

IanVS added 2 commits March 13, 2017 23:03
Fixes #832

Previously, we would find the fallback `.eslintrc.*` config file in a
user’s home directory, return that, and then potentially ignore it later
because it’s a fallback.  Only if there were _zero_ `.eslintrc.*` files
would we ever look for a package.json.

With this change, we will find a package.json file and check for an 
eslint configuration before traversing higher up the directory structure
and potentially encountering a fallback in the user’s home root.

It’s important that the `package.json` file come last in the array, so
that we look for `.eslintrc` config files first.  Otherwise, we may
find a package.json file without an eslintConfig, ignore it, and not bother
looking for a .eslintrc file in the same directory.

This still has the problem that hitting a `package.json` file without
an eslintConfig will prevent finding another config higher in the 
structure.  That fix will come in the next commit.
Fixes #768

This continues traversing up the directory structure after finding a 
`package.json` file which does not contain an `eslintConfig`.
@IanVS IanVS requested a review from Arcanemagus March 14, 2017 06:15
@IanVS IanVS merged commit 90cb8de into master Mar 14, 2017
@Arcanemagus Arcanemagus deleted the package-json-configs branch March 14, 2017 19:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants