Skip to content
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

feat(load): accept functions as parser presets #2982

Merged
merged 1 commit into from Jan 20, 2022

Conversation

Zirak
Copy link
Contributor

@Zirak Zirak commented Jan 19, 2022

Description

Previously, load could accept parserPresets as both values and promises of
values. Per #2964 however, there was expectations for it to also support
functions returning said values.

This commit enables to specify parserPresets in all the same ways as
rules. That is, both commitlint rules and parserPresets can be specified as:

  • Plain values
  • Promises
  • Functions returning plain values
  • Functions returning promises

Motivation and Context

See discussion in #2964.

How Has This Been Tested?

Wrote unit tests for load-parser-opts covering both new and old functionality.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Previously, `load` could accept `parserPresets` as both values and promises of
values. Per conventional-changelog#2964 however, there was expectations for it to also support
functions returning said values.

This commit enables to specify `parserPresets` in all the same ways as
rules. That is, both commitlint rules and `parserPresets` can be specified as:

- Plain values
- Promises
- Functions returning plain values
- Functions returning promises

Solves conventional-changelog#2964.
@escapedcat escapedcat merged commit 420e8d6 into conventional-changelog:master Jan 20, 2022
4 checks passed
@escapedcat
Copy link
Collaborator

@escapedcat escapedcat commented Jan 20, 2022

Thanks @Zirak !

@Zirak Zirak deleted the issue-2964 branch Jan 20, 2022
@Zirak
Copy link
Contributor Author

@Zirak Zirak commented Jan 20, 2022

Most welcome, thanks for your stewardship!

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

Successfully merging this pull request may close these issues.

None yet

2 participants