Skip to content

Commit 8c3ee6c

Browse files
committed
fix(cli): disable angular defaults when a rc file is provided
#4
1 parent 6a3700b commit 8c3ee6c

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

readme.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const report = lint(
7777
7878
### Recipes
7979
80-
* As a git `commitmsg` hook with husky
80+
* As a `commitmsg` git-hook with ["husky"](https://git.io/JDwyQg)
8181
8282
```json
8383
{
@@ -99,13 +99,17 @@ const report = lint(
9999
100100
## Configuration
101101
102-
`conventional-changelog-lint` allows detailed configuration via
102+
`conventional-changelog-lint` is configured via
103103
`.conventional-changelog-lintrc` and shareable configuration.
104-
By default it will use the
104+
105+
When no `.conventional-changelog-lintrc` is found it will use the
105106
[angular](https://github.com/marionebl/conventional-changelog-lint-config-angular#rules)
106107
shareable config.
107108
See the documentation there for default rules.
108109
110+
When a `.conventional-changelog-lintrc` is found it will **not** load any preset
111+
unless specified via [extends](#extends) configuration.
112+
109113
### extends
110114
111115
```js
@@ -150,8 +154,9 @@ for details
150154
}
151155
}
152156
```
157+
153158
Rules applicable to the linted commit messages.
154-
By default all rules are disabled via a level of 0.
159+
By default all rules are turned off via a level of 0.
155160
They can be enabled by shareable configuration,
156161
such as the
157162
[angular config](https://github.com/marionebl/conventional-changelog-lint-config-angular),

source/library/get-configuration.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,18 @@ const defaultSettings = {
1515
};
1616

1717
export default async (name = defaultName, settings = defaultSettings, seed = {}) => {
18+
// Obtain config from .rc files
19+
const userConfig = rc(name, settings.defaults);
20+
21+
// Use the default extends config if there is no userConfig
22+
// See https://git.io/vwT1C for reference
23+
const applicableDefaults = userConfig ?
24+
{} :
25+
defaults;
26+
1827
// Merge passed config with file based options
19-
const config = merge(rc(name, settings.defaults), seed);
20-
const opts = merge({}, defaults, pick(config, 'extends'));
28+
const config = merge(userConfig, seed);
29+
const opts = merge({}, applicableDefaults, pick(config, 'extends'));
2130

2231
// Resolve extends key
2332
const extended = resolveExtends(opts, settings.prefix);

0 commit comments

Comments
 (0)