acacode / swagger-typescript-api

Generate the API Client for Fetch or Axios from an OpenAPI Specification
MIT License
3.27k stars 354 forks source link

Alawys DELETE .prettierrc.cjs when run swagger-typescript-api #797

Open alaywn opened 3 months ago

alaywn commented 3 months ago

My Project file.prettierrc.cjs is always removed by swagger-typescript-api (recent versions)

smorimoto commented 3 months ago

Is that really related?

alaywn commented 3 months ago

Is that really related?

Yes,Every time it runs, it deletes that file.I also find it very strange why there is such a result.

smorimoto commented 3 months ago

What happens if you use json or yaml instead?

alaywn commented 3 months ago

What happens if you use json or yaml instead?

The following is the error message after using json:

`my_project_root_path/node_modules/.pnpm/parse-json@5.2.0/node_modules/parse-json/index.js:29 const jsonError = new JSONError(error); ^ ErrorEXError [JSONError]: JSON Error in my_project_root_path/.prettierrc.json: Unexpected token 'c', "const conf"... is not valid JSON while parsing 'const config = { embeddedInHtml: voi' Unexpected token 'c', "const conf"... is not valid JSON while parsing 'const config = { embeddedInHtml: voi' at parseJson (my_project_root_path/node_modules/.pnpm/parse-json@5.2.0/node_modules/parse-json/index.js:29:21) at loadJson (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/loaders.js:48:16) at #loadConfiguration (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/ExplorerSync.js:116:36) at #loadConfigFileWithImports (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/ExplorerSync.js:87:54) at #readConfiguration (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/ExplorerSync.js:84:82) at search (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/ExplorerSync.js:50:63) at emplace (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/util.js:36:20) at search (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/ExplorerSync.js:71:50) at emplace (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/util.js:36:20) at ExplorerSync.search (my_project_root_path/node_modules/.pnpm/cosmiconfig@9.0.0_typescript@5.5.3/node_modules/cosmiconfig/dist/ExplorerSync.js:78:42) { filepath: 'my_project_root_path/.prettierrc.json' } Thrown at: at throwUnhandledRejectionsMode (node:internal/process/promises:391:5) at processPromiseRejections (node:internal/process/promises:470:17) at processTicksAndRejections (node:internal/process/task_queues:96:32)

Node.js v22.4.0 `

alaywn commented 2 months ago

I think the issue has something to do with the new parameter "prettier"