Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lucasmotta
Copy link
Contributor

Description

plurarize is only used once in our sdk and it brings almost no value. Also, the package itself was last updated 6 years ago and does not support esm, so I think it's better to remove this now, as it already creates problems with esm only bundlers.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@lucasmotta lucasmotta requested a review from a team as a code owner November 5, 2025 00:26
@lucasmotta lucasmotta requested a review from atainter November 5, 2025 00:26
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

Removed the pluralize dependency and replaced its single usage with a simple ternary operator.

  • Removed pluralize (8.0.0) and @types/pluralize (0.0.30) from dependencies
  • Replaced pluralize('requirement', errors.length) with inline logic: errors.length === 1 ? 'requirement' : 'requirements'
  • Reduces bundle size and eliminates a stale dependency (last updated 6 years ago, no ESM support)

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change is straightforward and functionally equivalent - replacing a library call with simple conditional logic that handles both singular and plural cases correctly. The implementation only affects one file and the logic is trivial to verify
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
package.json 5/5 Removed pluralize dependency and its type definitions from dependencies
package-lock.json 5/5 Removed lockfile entries for pluralize and @types/pluralize
src/common/exceptions/unprocessable-entity.exception.ts 5/5 Replaced pluralize library with simple ternary operator for singular/plural logic

Sequence Diagram

sequenceDiagram
    participant Code as Application Code
    participant Exception as UnprocessableEntityException
    participant Output as Error Message
    
    Code->>Exception: new UnprocessableEntityException({errors: [...], ...})
    Exception->>Exception: Check errors.length
    alt errors.length === 1
        Exception->>Exception: requirement = "requirement"
    else errors.length > 1
        Exception->>Exception: requirement = "requirements"
    end
    Exception->>Output: "The following ${requirement} must be met:\n..."
    Output-->>Code: Error thrown with formatted message
Loading

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@lucasmotta lucasmotta merged commit 416bdf7 into main Nov 5, 2025
5 checks passed
@lucasmotta lucasmotta deleted the chore/remove-pluralize-dependency branch November 5, 2025 14:55
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.

3 participants