Merged
Conversation
Contributor
There was a problem hiding this comment.
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
2 files reviewed, no comments
ericroberts
approved these changes
Nov 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.