Skip to content

Commit

Permalink
use pkg-conf module for less code and improved JSON errors
Browse files Browse the repository at this point in the history
fixes #16
  • Loading branch information
sindresorhus committed Sep 3, 2015
1 parent 4fc25f4 commit d2a20bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
var path = require('path');
var eslint = require('eslint');
var globby = require('globby');
var lookUp = require('look-up');
var objectAssign = require('object-assign');
var arrify = require('arrify');
var pkgConf = require('pkg-conf');

var DEFAULT_PATTERNS = [
'**/*.js',
Expand Down Expand Up @@ -33,13 +33,7 @@ function handleOpts(opts) {
cwd: process.cwd()
}, opts);

var pkgOpts = {};

try {
pkgOpts = require(lookUp('package.json', {cwd: opts.cwd})).xo;
} catch (err) {}

opts = objectAssign({}, pkgOpts, opts);
opts = objectAssign({}, pkgConf.sync('xo', opts.cwd), opts);

// alias to help humans
opts.envs = opts.envs || opts.env;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"eslint-plugin-babel": "^2.1.1",
"get-stdin": "^5.0.0",
"globby": "^3.0.0",
"look-up": "^0.7.1",
"meow": "^3.3.0",
"object-assign": "^4.0.1",
"pkg-conf": "^1.0.1",
"update-notifier": "^0.5.0",
"xo-init": "^0.2.0"
},
Expand Down

0 comments on commit d2a20bc

Please sign in to comment.