Skip to content

[WIP] Add more options to CamelCasePlugin#1658

Open
wirekang wants to merge 2 commits intokysely-org:masterfrom
wirekang:issue-1627
Open

[WIP] Add more options to CamelCasePlugin#1658
wirekang wants to merge 2 commits intokysely-org:masterfrom
wirekang:issue-1627

Conversation

@wirekang
Copy link
Contributor

This PR will add more properties to CamelCasePluginOptions:

property description
ignoreSurroundingUnderscores?: boolean Ignore leading/trailing underscores, add as-is after conversion
removeSurroudingUnderscores?: boolean Remove leading/trailing underscores before conversion
customMapping?: Record<string,string> Provide custom conversion rule

In case of #1627, I think _id -> _Id conversion is a bug. So What's the correct one? _id or id? When I tested a bunch of snake_case to camelCase implementations, the golden rule was to remove leading underscores(_id -> id). But it would be great if there are more options to control some opinioned behavior, since there is no standard.

Closes #1627

WIP

First of all, I added a test file to test CamelCasePlugin independently.
Since the maintainer might reject this approach, I haven't implemented anything yet and also haven't declared all the test cases.

@vercel
Copy link

vercel bot commented Dec 12, 2025

@wirekang is attempting to deploy a commit to the Kysely Team Team on Vercel.

A member of the Team first needs to authorize it.

['asis', 'asis'],
['foo_bar', 'fooBar'],
['a_f_o_o_bar', 'aFOOBar'],
['_id', '_Id'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, this test case is passing. I think it should modified like ['_id', 'id']

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.

CamelCasePlugin incorrectly cases column names starting with _

1 participant