Skip to content

Commit

Permalink
fix: pluralization rule for the info word (#10599)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage authored Dec 13, 2024
1 parent 0380328 commit ae1d875
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/types/src/common/__tests__/pluralize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe("Pluralize", () => {
expectTypeOf<Pluralize<"series">>().toEqualTypeOf<"series">()
expectTypeOf<Pluralize<"species">>().toEqualTypeOf<"species">()
expectTypeOf<Pluralize<"deer">>().toEqualTypeOf<"deer">()
expectTypeOf<Pluralize<"info">>().toEqualTypeOf<"info">()
})

test("pluralize words ending with fe", () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/core/types/src/common/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export interface SoftDeletableEntity extends BaseEntity {
/**
* Temporary type fixing to allow any level of orders until we get to properly clean all the types
*/
export type FindConfigOrder = { [Key: string]: "ASC" | "DESC" | string & {} | FindConfigOrder }
export type FindConfigOrder = {
[Key: string]: "ASC" | "DESC" | (string & {}) | FindConfigOrder
}

/**
* @interface
Expand Down Expand Up @@ -344,6 +346,7 @@ type UncountableRules =
| "you"
| "deer"
| "sheep"
| "info"

type PluralizationSpecialRules = {
person: "people"
Expand Down
1 change: 1 addition & 0 deletions packages/core/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@graphql-tools/merge": "^9.0.7",
"@graphql-tools/schema": "^10.0.6",
"@medusajs/types": "^2.1.1",
"@types/pluralize": "^0.0.33",
"bignumber.js": "^9.1.2",
"dotenv": "^16.4.5",
"dotenv-expand": "^11.0.6",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/utils/src/common/__tests__/pluralize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("pluralize", function () {
"hero",
"potato",
"address",
"info",
]

const expectedOutput = [
Expand All @@ -24,6 +25,7 @@ describe("pluralize", function () {
"heroes",
"potatoes",
"addresses",
"info",
]

words.forEach((word, index) => {
Expand Down
1 change: 1 addition & 0 deletions packages/core/utils/src/common/plurailze.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pluralizeEN from "pluralize"
pluralizeEN.addUncountableRule("info")

/**
* Function to pluralize English words.
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6764,6 +6764,7 @@ __metadata:
"@swc/core": ^1.7.28
"@swc/jest": ^0.2.36
"@types/express": ^4.17.21
"@types/pluralize": ^0.0.33
awilix: ^8.0.1
bignumber.js: ^9.1.2
dotenv: ^16.4.5
Expand Down Expand Up @@ -13856,6 +13857,13 @@ __metadata:
languageName: node
linkType: hard

"@types/pluralize@npm:^0.0.33":
version: 0.0.33
resolution: "@types/pluralize@npm:0.0.33"
checksum: 24899caf85b79dd291a6b6e9b9f3b67b452b18d578d0ac0d531a705bf5ee0361d9386ea1f8532c64de9e22c6e9606c5497787bb5e31bd299c487980436c59785
languageName: node
linkType: hard

"@types/pretty-hrtime@npm:^1.0.0":
version: 1.0.3
resolution: "@types/pretty-hrtime@npm:1.0.3"
Expand Down

0 comments on commit ae1d875

Please sign in to comment.