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

fix(types): adds TargetCaseType[] for CaseRuleConfig #2670

Merged
merged 1 commit into from Jul 13, 2021
Merged

fix(types): adds TargetCaseType[] for CaseRuleConfig #2670

merged 1 commit into from Jul 13, 2021

Conversation

chanceaclark
Copy link
Contributor

Description

CaseRuleConfig now accepts TargetCaseType | TargetCaseType[].

Fixes #2631.

Motivation and Context

Building a plugin + config package and running into the issue with all the CaseRuleConfig types don't except an array of cases.

Usage examples

// index.ts (config package)
const config: UserConfig = {
  extends: ['@commitlint/config-conventional'],
  plugins: ['@bigcommerce/commitlint-plugin-jira'],
  rules: {
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-expect-error
    'subject-case': [2, 'never', ['start-case', 'pascal-case']],
  },
};

exports = config;

How Has This Been Tested?

Installed and tested changes locally
Screen Shot 2021-07-08 at 13 15 08

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.

@escapedcat
Copy link
Member

Thanks!

@AdeAttwood
Copy link
Member

As is think this type is a bit to general for CaseRuleConfig we have a few rules that use this type, and not all of them accept a TargetCaseType[].

We have:

  • body-case TargetCaseType
  • header-case TargetCaseType | TargetCaseType[]
  • scope-case TargetCaseType | TargetCaseType[]
  • subject-case TargetCaseType | TargetCaseType[]
  • type-case TargetCaseType | TargetCaseType[]

I have amended body-case to now accept TargetCaseType | TargetCaseType[] in #2671. So when the two PRs are merged, we should be all good.

@chanceaclark @escapedcat What do you think?

@chanceaclark
Copy link
Contributor Author

chanceaclark commented Jul 9, 2021

@AdeAttwood I thought I covered all of them, good catch! 😅 But I like that plan. I'll keep watching out for that PR to get merged and I'll rebase when I see it.

@AdeAttwood
Copy link
Member

@chanceaclark PRs have now been merged, thanks for your contribution.

@chanceaclark chanceaclark deleted the chore/fix-typez branch July 13, 2021 19:11
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.

CaseRuleConfig<V> does not support array/tuple values
3 participants