Case-transformation methods like ${name.toPascalCase()} use built-in casing rules by default. For acronyms (AI, API, DB, URL) and unconventional casing, those defaults produce wrong output:
${name.toPascalCase()} // openai → "Openai" (wrong: should be "OpenAI")
${name.toCamelCase()} // openai → "openai" (wrong: should be "openAI")
Declare top-level case maps in konsistent.json to override the defaults.
Override toPascalCase() and toNthSegmentPascalCase() for specific kebab-case values.
{
"version": "v1",
"kebabToPascalMap": {
"openai": "OpenAI",
"graphql": "GraphQL",
"api": "API"
}
}With this map:
${name.toPascalCase()}foropenai→OpenAI${name.toPascalCase()}formistralai→Mistralai(no entry, falls back to default)${name.toNthSegmentPascalCase(0)}foropenai-chat→OpenAI
Override toCamelCase() and toNthSegmentCamelCase() for specific kebab-case values.
{
"version": "v1",
"kebabToCamelMap": {
"openai": "openAI",
"graphql": "graphQL"
}
}${name.toCamelCase()} for openai → openAI.
{
"version": "v1",
"kebabToPascalMap": {
"openai": "OpenAI",
"graphql": "GraphQL"
},
"kebabToCamelMap": {
"openai": "openAI"
},
"conventions": [
{
"paths": "providers/{providerId}/index.ts",
"must": {
"exportFunctions": [
{ "name": "create${providerId.toPascalCase()}Provider" }
],
"exportTypes": ["${providerId.toPascalCase()}ProviderConfig"]
}
}
]
}For providers/openai/index.ts, the rule expects:
createOpenAIProvider(instead of the defaultcreateOpenaiProvider)OpenAIProviderConfig(instead ofOpenaiProviderConfig)
Without the case map, the rule would flag every correctly-named OpenAI* export as a violation.
Only kebabToPascalMap and kebabToCamelMap are configurable. The inverse and cross-direction maps are derived automatically:
| Direction | Source |
|---|---|
pascalToKebabMap |
inverse of kebabToPascalMap |
camelToKebabMap |
inverse of kebabToCamelMap |
pascalToCamelMap |
composed: pascal → kebab → camel |
camelToPascalMap |
composed: camel → kebab → pascal |
This means ${name.toKebabCase()} for OpenAI resolves to openai automatically — declaring kebabToPascalMap is enough to make the round-trip work.
Add an entry to a case map when:
- An identifier in your codebase contains an acronym (
AI,API,DB,URL,OAuth,HTTP, …) and the default casing breaks names. - A vendor or product name uses unusual casing (
GraphQL,OpenAI,iOS).
Skip case maps when:
- The kebab-case form is purely lowercase letters and the PascalCase / camelCase form follows standard rules. The defaults handle these correctly without overrides.
Run konsistent validate after adding entries — typos in keys are silent (no error from the schema), but you'll see them quickly when running konsistent check reports unexpected violations.