Skip to content

Commit 764aa8b

Browse files
committed
feat(load): display warning when config is empty conventional-changelog#107
1 parent 4eda933 commit 764aa8b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

@commitlint/load/src/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import merge from 'lodash.merge';
77
import mergeWith from 'lodash.mergewith';
88
import pick from 'lodash.pick';
99
import resolveFrom from 'resolve-from';
10+
// Import chalk from 'chalk';
1011

1112
const w = (a, b) => (Array.isArray(b) ? b : undefined);
1213
const valid = input => pick(input, 'extends', 'rules', 'parserPreset');
@@ -89,6 +90,13 @@ async function loadConfig(cwd, configPath) {
8990
if (local) {
9091
return local;
9192
}
93+
// Because local is `null`
94+
// throw new Error(`123`);
95+
96+
console.log('NEIN DER ZWERG DAS IST JA OTTO');
97+
98+
// This does not show up in tests
99+
// chalk.yellow(`⚠ ${chalk.bold('config file')} may not be empty.`);
92100

93101
return {};
94102
}

@commitlint/load/src/index.serial-test.js

+16
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,19 @@ test.serial('default cwd option to process.cwd()', async t => {
1717
process.chdir(before);
1818
}
1919
});
20+
21+
// Test.serial('empty cwd option to process.cwd() should throw error message', async t => {
22+
// const cwd = await fix.bootstrap('fixtures/empty-file');
23+
// const before = process.cwd();
24+
// process.chdir(cwd);
25+
26+
// try {
27+
// const actual = await load();
28+
// } catch (err) {
29+
// console.log('-------------------------')
30+
// // t.true(err.includes('OTTO'));
31+
// // throw err;
32+
// } finally {
33+
// process.chdir(before);
34+
// }
35+
// });

0 commit comments

Comments
 (0)