Skip to content

Commit

Permalink
Don't delete pkg.xo on init (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
dflupu authored and sindresorhus committed Sep 26, 2019
1 parent 6090a3f commit 38c3180
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ module.exports = (opts = {}) => {
}

if (Object.keys(cli).length > 0) {
pkg.xo = cli;
} else if (pkg.xo) {
delete pkg.xo;
pkg.xo = Object.assign({}, pkg.xo, cli);
}

writePkg.sync(pkgPath, pkg);
Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ test('has cli args and existing config', async t => {
process.argv = originalArgv;
t.is(get(pkg, 'scripts.test'), 'xo');
t.is(get(pkg, 'xo.space'), true);
t.is(get(pkg, 'xo.esnext'), undefined);
t.is(get(pkg, 'xo.esnext'), true);
});

test('has existing config without cli args', async t => {
Expand All @@ -128,7 +128,7 @@ test('has existing config without cli args', async t => {

process.argv = originalArgv;
t.is(get(pkg, 'scripts.test'), 'xo');
t.is(get(pkg, 'xo'), undefined);
t.deepEqual(get(pkg, 'xo'), {esnext: true});
});

test('has everything covered when it comes to config', async t => {
Expand Down

0 comments on commit 38c3180

Please sign in to comment.