Skip to content

Commit

Permalink
fix(lib): Restore original behavior when invoking without any argument
Browse files Browse the repository at this point in the history
Restore the module's original behavior of interpreting the current package's main script as source
of an eslint config, rather than taking the local package.json's eslintConfig property into account.
  • Loading branch information
ta2edchimp committed Mar 19, 2016
1 parent 5277e66 commit 14a9de7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ if (newRules.length) {
process.exit(1)
}

function resolvePackagesMain(cwd, packageFile) {
var packageFilePath = path.join(cwd, packageFile)
var packageJson = require(packageFilePath)
return packageJson.main
}

function getConfigFile() {
var specifiedFile = process.argv[2]
if (specifiedFile) {
Expand All @@ -28,7 +34,7 @@ function getConfigFile() {
}
} else {
// this is not being called with an arg. Use the package.json `main`
return path.join(process.cwd(), 'package.json')
return resolvePackagesMain(process.cwd(), 'package.json')
}
}

Expand Down

0 comments on commit 14a9de7

Please sign in to comment.