Skip to content

Commit 36f7f38

Browse files
pvdlgsindresorhus
authored andcommitted
Fix space/useTabs conflict message (#327)
1 parent 0765998 commit 36f7f38

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lib/options-manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ const mergeWithPrettierConf = (opts, prettierOpts) => {
129129
throw new Error(`The Prettier config \`semi\` is ${prettierOpts.semi} while XO \`semicolon\` is ${opts.semicolon}`);
130130
}
131131

132-
if (((opts.space === true || typeof opts.space === 'number') && prettierOpts.useTabs === false) ||
133-
((opts.space === false || typeof opts.space === 'number') && prettierOpts.useTabs === true)) {
132+
if (((opts.space === true || typeof opts.space === 'number') && prettierOpts.useTabs === true) ||
133+
((opts.space === false) && prettierOpts.useTabs === false)) {
134134
throw new Error(`The Prettier config \`useTabs\` is ${prettierOpts.useTabs} while XO \`space\` is ${opts.space}`);
135135
}
136136

test/options-manager.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,12 @@ test('mergeWithPrettierConf: throw error is `semi`/`semicolon` conflicts', t =>
279279
});
280280

281281
test('mergeWithPrettierConf: throw error is `space`/`useTabs` conflicts', t => {
282-
t.throws(() => manager.mergeWithPrettierConf({space: true}, {useTabs: false}));
283-
t.throws(() => manager.mergeWithPrettierConf({space: 4}, {useTabs: false}));
284-
t.throws(() => manager.mergeWithPrettierConf({space: 0}, {useTabs: false}));
285-
t.throws(() => manager.mergeWithPrettierConf({space: false}, {useTabs: true}));
282+
t.throws(() => manager.mergeWithPrettierConf({space: false}, {useTabs: false}));
283+
t.throws(() => manager.mergeWithPrettierConf({space: true}, {useTabs: true}));
286284

287-
t.notThrows(() => manager.mergeWithPrettierConf({space: false}, {useTabs: false}));
288-
t.notThrows(() => manager.mergeWithPrettierConf({space: true}, {useTabs: true}));
285+
t.notThrows(() => manager.mergeWithPrettierConf({space: 4}, {useTabs: false}));
286+
t.notThrows(() => manager.mergeWithPrettierConf({space: true}, {useTabs: false}));
287+
t.notThrows(() => manager.mergeWithPrettierConf({space: false}, {useTabs: true}));
289288
});
290289

291290
test('mergeWithPrettierConf: throw error is `space`/`tabWidth` conflicts', t => {

0 commit comments

Comments
 (0)