Skip to content

Commit

Permalink
fix(cli): disable angular defaults when a rc file is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Apr 15, 2016
1 parent 6a3700b commit 8c3ee6c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 9 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const report = lint(
### Recipes
* As a git `commitmsg` hook with husky
* As a `commitmsg` git-hook with ["husky"](https://git.io/JDwyQg)
```json
{
Expand All @@ -99,13 +99,17 @@ const report = lint(
## Configuration
`conventional-changelog-lint` allows detailed configuration via
`conventional-changelog-lint` is configured via
`.conventional-changelog-lintrc` and shareable configuration.
By default it will use the
When no `.conventional-changelog-lintrc` is found it will use the
[angular](https://github.com/marionebl/conventional-changelog-lint-config-angular#rules)
shareable config.
See the documentation there for default rules.
When a `.conventional-changelog-lintrc` is found it will **not** load any preset
unless specified via [extends](#extends) configuration.
### extends
```js
Expand Down Expand Up @@ -150,8 +154,9 @@ for details
}
}
```
Rules applicable to the linted commit messages.
By default all rules are disabled via a level of 0.
By default all rules are turned off via a level of 0.
They can be enabled by shareable configuration,
such as the
[angular config](https://github.com/marionebl/conventional-changelog-lint-config-angular),
Expand Down
13 changes: 11 additions & 2 deletions source/library/get-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@ const defaultSettings = {
};

export default async (name = defaultName, settings = defaultSettings, seed = {}) => {
// Obtain config from .rc files
const userConfig = rc(name, settings.defaults);

// Use the default extends config if there is no userConfig
// See https://git.io/vwT1C for reference
const applicableDefaults = userConfig ?
{} :
defaults;

// Merge passed config with file based options
const config = merge(rc(name, settings.defaults), seed);
const opts = merge({}, defaults, pick(config, 'extends'));
const config = merge(userConfig, seed);
const opts = merge({}, applicableDefaults, pick(config, 'extends'));

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

0 comments on commit 8c3ee6c

Please sign in to comment.