Skip to content

Replace array config value rather than override element(s) #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
whizark opened this issue Dec 3, 2016 · 3 comments
Closed

Replace array config value rather than override element(s) #18

whizark opened this issue Dec 3, 2016 · 3 comments
Labels

Comments

@whizark
Copy link
Contributor

whizark commented Dec 3, 2016

At first, thank you for your great work. conventional-changelog-lint with "husky" (my preference) really helps to keep clear commit messages with no pains.

BTW, I noticed that user configuration value, if it is an Array value, overrides element(s) of the value of sharable configuration. I don't know it is designed but it seems to be nice if user value replaces sharable configuration value rather than overriding.

For example:

conventional-changelog-lint-config-extendee/index.js
(in sharable configuration package: conventional-changelog-lint-config-extendee)

'use strict';

module.exports = {
    rules: {
        'type-enum': [
            2,
            'always',
            [
                'extendee-type-1',
                'extendee-type-2'
            ]
        ]
    }
};

.conventional-changelog-lintrc (user config)

{
    "extends": [
        "extendee"
    ],
    "rules"  : {
        "type-enum": [
            2,
            "always",
            [
                "user-type"
            ]
        ]
    }
}

Steps

When I run conventional-changelog-lint,

echo "invalid message" | conventional-changelog-lint

It produces the following result.

⧗   input: invalid message
✖   type must be one of ["user-type", "extendee-type-2"] [type-enum]
✖   found 1 problems, 0 warnings

Expected result

type must be one of ["user-type"] [type-enum]

The user config's ["user-type"] replaces sharable configuration's ['extendee-type-1', 'extendee-type-2'].

Actual result

type must be one of ["user-type", "extendee-type-2"] [type-enum]

The user config's ["user-type"] overrides a part of sharable configuration's ['extendee-type-1', 'extendee-type-2'].

Environment

Node.js 7.x.x + conventional-changelog-lint 1.1.0

@marionebl
Copy link
Contributor

Hey there! Thank you for contributing this issue. I am on a long travel leg and can't analyse right now - probably soonest sometime next week.

whizark added a commit to whizark/commitlint-config-cz that referenced this issue Dec 10, 2016
@marionebl
Copy link
Contributor

Looks like faulty config merging logic, this is definitely a bug.

@marionebl
Copy link
Contributor

Fixed by #30 and released. Feel free to reopen if problem persists!

❯ npm show conventional-changelog-lint .version
1.1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants