Skip to content

fix: Escape dollar sign for Windows local setup commands #4728

Closed

Description

@festoney8

Steps to Reproduce

1. Use Windows PowerShell and any package manager in [npm, yarn, pnpm, bun, deno]
2. Follow the local setup guide, run command for Windows users.

Current Behavior

This issue is related to PR #4559, which added a backtick to the commands for various package managers (npm, yarn, pnpm, bun, deno).

# Before PR
echo "pnpm dlx commitlint --edit `$1" > .husky/commit-msg

# After PR
echo "pnpm dlx commitlint --edit `$1`" > .husky/commit-msg

This change appears to make the command invalid. In powershell doc, escape sequences begin with the backtick character in double-quoted strings.

Test in PowerShell 5.1:

Image

Expected Behavior

Fix the command for all package manangers, and please indicate the windows command is only for Powershell user in doc.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

If my findings are correct, I’d glad to create a PR to fix it.

Context

No response

commitlint --version

@commitlint/cli@20.5.0

git --version

v2.53.0

node --version

v24.12.0

Activity

  1. escapedcat commented on Apr 22, 2026

    @escapedcat
    Member

    Sure, happy for a PR

    Claude:

    Recommended Fix

    Revert the trailing-backtick change from PR #4559 on those five lines, restoring single-backtick PowerShell escaping. The bash error that PR #4559
    attempted to silence is a non-issue in practice because:

    1. The line is explicitly labelled "Windows users should use ` to escape dollar signs" — it is PowerShell-specific.
    2. Windows users following the guide run this in PowerShell (the default shell of Windows Terminal / cmd environments wrapping pwsh), not bash.
    3. The bash/git-bash user already has the first variant (line above) using $1, which works in bash.

    Files to modify

    • docs/guides/local-setup.md — revert lines 42, 65, 91, 114, 130: remove the trailing so each becomes echo "<pm cmd> commitlint --edit \$1" > .husky/commit-msg.

    Optional improvement

    Also worth considering (but not strictly required to resolve the bug): change the comment above each PowerShell line from Windows users should use \ to escape dollar signsto# PowerShell (Windows): use to escape the dollar sign
    — explicitly naming PowerShell since the escaping rule is shell-specific, not OS-specific (git-bash on Windows follows bash rules).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions