Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Typescript support for '@commitlint/config-pnpm-scopes' #4536

Closed
@maxdzin

Description

Steps to Reproduce

  1. Install
    pnpm add -d @commitlint/cli @commitlint/config-conventional @commitlint/config-pnpm-scopes @commitlint/cz-commitlint @commitlint/types
  2. Create commitlint.config.ts:
    import scopes from '@commitlint/config-pnpm-scopes'
    import type { UserConfig } from '@commitlint/types'
    import { RuleConfigSeverity } from '@commitlint/types'
    const Configuration: UserConfig = {
     extends: [
     '@commitlint/config-conventional',
     '@commitlint/config-pnpm-scopes',
     ],
     rules: {
     'type-enum': [
     RuleConfigSeverity.Error,
     'always',
     [
     'build',
     'chore',
     'ci',
     'docs',
     'feat',
     'fix',
     'perf',
     'refactor',
     'revert',
     'style',
     'test',
     ],
     ],
     // @ts-expect-error Context is missing in declaration of config-pnpm-scopes
     'scope-enum': async (ctx) => {
     const scopeEnum = await scopes.rules['scope-enum'](ctx)
     return [
     scopeEnum[0],
     scopeEnum[1],
     [
     ...scopeEnum[2],
     'workspace', // for project workspace related changes
     'workflows', // for project github workflows actions related changes
     'deps', // for Dependabot or Renovate - dependency updates
     'dev-deps', // for Dependabot or Renovate - dev dependency updates
     'release', // for release commits
     ],
     ]
     },
     },
     ignores: [(commit) => /^Bumps\[.+\]\(.+\)from.+to.+\.$/m.test(commit)],
     prompt: {
     settings: {
     enableMultipleScopes: true,
     },
     },
    }
    export default Configuration

See TS error for the first line:

Could not find a declaration file for module '@commitlint/config-pnpm-scopes'.

Current Behavior

When defining config as a TS file, it is impossible to use @commitlint/config-pnpm-scopes because it lacks TS support.

Expected Behavior

Since it is possible to define commitlint in TS nowadays, its additional tools (like '@commitlint/config-pnpm-scopes') require TS support too.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Context

No response

commitlint --version

@commitlint/cli@19.8.1

git --version

2.51.0

node --version

v22.18.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /