Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! fix: pass defaultIgnores from configuration in @commitlint/cli
  • Loading branch information
ResDiaryLewis committed Aug 1, 2019
commit 8903ef5d69904bf1494646f8e8fb28ee4160fbee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
rules: {
'subject-empty': [2, 'never']
}
};
6 changes: 3 additions & 3 deletions @commitlint/cli/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async function main(options) {
parserOpts: {},
plugins: {},
ignores: [],
defaultIgnores: false
defaultIgnores: true
};
if (parserOpts) {
opts.parserOpts = parserOpts;
Expand All @@ -159,8 +159,8 @@ async function main(options) {
if (loaded.ignores) {
opts.ignores = loaded.ignores;
}
if (loaded.defaultIgnores) {
opts.defaultIgnores = loaded.defaultIgnores;
if (loaded.defaultIgnores === false) {
opts.defaultIgnores = false;
}
const format = loadFormatter(loaded, flags);

Expand Down
12 changes: 9 additions & 3 deletions @commitlint/cli/src/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,19 @@ test('should not skip linting if message does not match ignores config', async t
test('should not skip linting if defaultIgnores is false', async t => {
const cwd = await git.bootstrap('fixtures/default-ignores-false');
const actual = await cli([], {cwd})('fixup! foo: bar');
t.is(actual.code, 0);
t.is(actual.code, 1);
});

test('should skip linting if defaultIgnores is true', async t => {
const cwd = await git.bootstrap('fixtures/default-ignores-false');
const cwd = await git.bootstrap('fixtures/default-ignores-true');
const actual = await cli([], {cwd})('fixup! foo: bar');
t.is(actual.code, 1);
t.is(actual.code, 0);
});

test('should skip linting if defaultIgnores is unset', async t => {
const cwd = await git.bootstrap('fixtures/default-ignores-unset');
const actual = await cli([], {cwd})('fixup! foo: bar');
t.is(actual.code, 0);
});

test('should fail for invalid formatters from flags', async t => {
Expand Down