acacode / swagger-typescript-api

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

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

Open alaywn opened 4 months ago

alaywn commented 4 months ago

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

smorimoto commented 4 months ago

Is that really related?

alaywn commented 4 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 4 months ago

What happens if you use json or yaml instead?

alaywn commented 4 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 4 months ago

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