Skip to content

fix: sort contributors alphabetically case-insensitively with login fallback - #531

Open
vjymisal0 wants to merge 1 commit into
all-contributors:mainfrom
vjymisal0:fix/case-insensitive-contributor-sort
Open

fix: sort contributors alphabetically case-insensitively with login fallback#531
vjymisal0 wants to merge 1 commit into
all-contributors:mainfrom
vjymisal0:fix/case-insensitive-contributor-sort

Conversation

@vjymisal0

@vjymisal0 vjymisal0 commented Aug 28, 2026

Copy link
Copy Markdown

Description

Fixes #370

Currently, when \contributorsSortAlphabetically: true\ is configured, sorting is performed directly on \�.name\ using default \localeCompare. This leads to:

  1. Capitalized names (A-Z) and lowercase names (a-z) sorting into separate clusters rather than a natural, case-insensitive alphabetical sequence.
  2. Contributor records that lack an explicit
    ame\ property sorting incorrectly as empty strings instead of falling back to their \login.

Changes Made

  • Updated \generateContributorsList\ in src/generate/index.js to sort with \localeCompare(..., undefined, { sensitivity: 'base' })\ with fallback to standard \localeCompare.
  • Added fallback to contributor \login\ when
    ame\ is not present, matching the display fallback in src/generate/format-contributor.js.
  • Added comprehensive unit tests in src/generate/tests/index.js validating case-insensitive sorting and missing name fallbacks.
  • Updated path assertions in src/util/tests/git.js to ensure cross-platform compatibility across Windows, macOS, and Linux.

Testing

  • Ran
    pm test\ with 100% tests passing (15 test files, 116 tests).
  • Verified ESLint and Prettier formatting checks passed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

contributorsSortAlphabetically alphabetical sort shouldn't be case sensitive

1 participant