fjc0k/yapi-to-typescript

运行时prettier报错

zlx362211854 opened this issue · 1 comments

运行npx ytt -c ytt.config.ts 时报错,下面是控制台输出和依赖版本

zhaolinxiao@zlx site % npx ytt -c ytt.config.ts
✔ 找到配置文件: /Users/zhaolinxiao/workspace/site/ytt.config.ts                                                                                                       11:37:52
✔ 获取数据并生成代码完毕                                                                                                                                              11:37:55
jsxBracketSameLine is deprecated.

 ERROR  Error: Debug Failure.                                                                                                                                         11:37:55
    at /Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:831968
    at String.replace (<anonymous>)
    at dn (/Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:831917)
    at Object.e.createDetachedDiagnostic (/Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:840922)
    at le (/Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:1015550)
    at _e (/Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:1015613)
    at ue (/Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:1015438)
    at Be (/Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:1018385)
    at Re (/Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:1017442)
    at /Users/zhaolinxiao/workspace/site/node_modules/yapi-to-typescript/node_modules/prettier/parser-typescript.js:22:1058069

zhaolinxiao@zlx site % npm ls yapi-to-typescript
siteApp@1.0.0 /Users/zhaolinxiao/workspace/site
└── yapi-to-typescript@3.26.2 

zhaolinxiao@zlx site % npm ls prettier
siteApp@1.0.0 /Users/zhaolinxiao/workspace/site
├── prettier@2.0.5 
├─┬ umi@3.5.20
│ └─┬ @umijs/deps@3.5.20
│   └── prettier@2.2.1 
└─┬ yapi-to-typescript@3.26.2
  ├─┬ json-schema-to-typescript@10.1.5
  │ └── prettier@2.4.1 
  └── prettier@2.4.1 

zhaolinxiao@zlx site % cat .prettierrc
{
  "proseWrap": "always",
  "printWidth": 20,
  "singleQuote": true,
  "trailingComma": "all",
  "bracketSpacing": false,
  "jsxBracketSameLine": false,
  "tabWidth": 2,
  "semi": false
}
zhaolinxiao@zlx site % cat ytt.config.ts 
import { Config } from "yapi-to-typescript";
export default {
  outputFilePath: 'src/api/declare',
  requestFunctionFilePath: 'src/api/request.ts',
  reactHooks: {
    enabled: true
  },
  comment: {},
  serverUrl: 'http://yapi.xxx.com/',
  projects: [
    {
      token: 'my token',
      categories: [
        {
          id: 0
        }
      ]
    }
  ]
} as Config

jsxBracketSameLine is deprecated 估计是这个配置在新版本被移除了,试试删掉运行一下