schemats icon indicating copy to clipboard operation
schemats copied to clipboard

Separate camel caseing options

Open HoldYourWaffle opened this issue 5 years ago • 2 comments

I created separate options for camelCaseing type names and column names.

Use case: I wanted camelCased type names for aesthetic and readability reasons while keeping the structural integrate type checking provided by non-modified column names.

I have added tests accordingly. I had to add 2 type assertions in the cli integration test due to a strict undefined checking error, but since the test is skipped if the concerning variable is undefined this shouldn't cause any issues.

HoldYourWaffle avatar Jun 03 '19 22:06 HoldYourWaffle

I was just about to add this myself, for the same reasons you cited. For what it's worth, I checked your code and it all looks good.

Rather than adding two more options, did you consider overloading the existing camelCase option with columns and types string values? Like this:

export type OptionValues = {
    camelCase?: boolean | 'columns' | 'types';
    writeHeader?: boolean;
}

I think this shouldn't present any compatibility concerns, and it has a smaller API surface area.

cmmartti avatar Jun 12 '19 02:06 cmmartti

To be honest I didn't think about that, of course that's a way better solution (in my defense, it was very late...) I have implemented this new system now.

HoldYourWaffle avatar Jun 12 '19 21:06 HoldYourWaffle