Fetcher with `paramsCasing: 'camelcase'` generates unused snake case variables
bug@kubb/plugin-client
### What version of `kubb` is running?
4.37.0
### What kind of platform do you use?
Linux
### Your `kubb.config.ts` config file?
```typescript
import { type Group, defineConfig } from '@kubb/core';
import { pluginClient } from '@kubb/plugin-client';
import { pluginOas } from '@kubb/plugin-oas';
import { pluginTs } from '@kubb/plugin-ts';
import { pluginZod } from '@kubb/plugin-zod';
const group: Group = {
type: 'tag',
name: ({ group: groupName }) => groupName,
};
export default defineConfig({
name: 'example-app',
root: '.',
input: {
path: '../openapi.json',
},
output: {
path: './src/__generated__',
clean: true,
extension: { '.ts': '' },
barrelType: 'named',
},
plugins: [
pluginOas({ generators: [] }),
pluginTs({
output: { path: 'types', banner },
group,
enumType: 'literal',
enumSuffix: '',
integerType: 'number',
unknownType: 'unknown',
paramsCasing: 'camelcase',
}),
pluginZod({
output: { path: 'schemas', banner },
group,
unknownType: 'unknown',
version: '4',
}),
pluginClient({
output: { path: 'fetchers', banner },
group,
dataReturnType: 'full',
urlType: 'export',
paramsType: 'object',
paramsCasing: 'camelcase',
pathParamsType: 'object',
parser: 'zod',
client: 'fetch',
}),
],
});
```
### Swagger/OpenAPI file?
```bash
{
"openapi": "3.1.0",
"info": {
"title": "example-app",
"version": "0.0.0"
},
"paths": {
"/v1/items/{item_id}": {
"get": {
"tags": [
"Items"
],
"summary": "Get Item",
"operationId": "get_item",
"parameters": [
{
"name": "item_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Item Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
}
}
}
```
### What version of external packages are you using(`@tanstack-query`, `MSW`, `React`, `Vue`, ...)
Irrelevant
### What steps can reproduce the bug?
1. Set TypeScript `noUnusedLocals` to `true`.
2. Use provided config and openapi spec to generate fetchers.
3. Observe that generated output contains unused variable `const item_id = itemId;` with the TypeScript error `'item_id' is declared but its value is never read. ts(6133)`
### How often does this bug happen?
Every time
### What is the expected behavior?
Skip outputting the variable altogether, since the fetcher accepts the camelcased variant.
### Additional information
Kubb `v4.20.5` is the last version I could find that doesn't display this bug
1 条评论