Closed Renderz closed 2 years ago
如果项目存在
"devDependencies": { "@umijs/fabric": "^2.8.1", "prettier": "^2.4.1" }
那么使用以下语法vscode的prettier extension表现正常
import type { AxiosRequestConfig } from 'axios';
如果删掉prettier。
"devDependencies": { "@umijs/fabric": "^2.8.1", }
vscode的prettier extension会报如下报错
"INFO" - 4:09:06 PM] Extension Name: esbenp.prettier-vscode. ["INFO" - 4:09:06 PM] Extension Version: 9.0.0. ["INFO" - 4:09:08 PM] File Info: { "ignored": false, "inferredParser": "typescript" } ["INFO" - 4:09:08 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used ["INFO" - 4:09:08 PM] Prettier Options: { "filepath": "/index.ts", "parser": "typescript", "singleQuote": true, "trailingComma": "all", "printWidth": 100, "proseWrap": "never", "endOfLine": "lf" } ["ERROR" - 4:09:08 PM] Error formatting document. ["ERROR" - 4:09:08 PM] '=' expected. (1:13) > 1 | import type { AxiosRequestConfig } from 'axios'; | ^ SyntaxError: '=' expected. (1:13) > 1 | import type { AxiosRequestConfig } from 'axios'; | ^ at t (/Users/jiangyifeng/github/requex/node_modules/prettier/parser-typescript.js:1:347) at Object.parse (/Users/jiangyifeng/github/requex/node_modules/prettier/parser-typescript.js:14:180461) at Object.parse (/Users/jiangyifeng/github/requex/node_modules/prettier/index.js:9739:19) at coreFormat (/Users/jiangyifeng/github/requex/node_modules/prettier/index.js:13252:23) at format (/Users/jiangyifeng/github/requex/node_modules/prettier/index.js:13510:73) at formatWithCursor (/Users/jiangyifeng/github/requex/node_modules/prettier/index.js:13526:12) at /Users/jiangyifeng/github/requex/node_modules/prettier/index.js:44207:15 at Object.format (/Users/jiangyifeng/github/requex/node_modules/prettier/index.js:44226:12) at t.default.<anonymous> (/Users/jiangyifeng/.vscode/extensions/esbenp.prettier-vscode-9.0.0/dist/extension.js:1:14671) at Generator.next (<anonymous>) at s (/Users/jiangyifeng/.vscode/extensions/esbenp.prettier-vscode-9.0.0/dist/extension.js:1:7872) ["INFO" - 4:09:08 PM] Formatting completed in 0.081ms.
prettier拓展应该是最高版本的。。。 不太清楚为啥会有以下问题,这个是vscode拓展的问题么?
prettier 扩展的版本很低的,还不支持 less。 你最好使用本地的
如果项目存在
那么使用以下语法vscode的prettier extension表现正常
如果删掉prettier。
vscode的prettier extension会报如下报错
prettier拓展应该是最高版本的。。。 不太清楚为啥会有以下问题,这个是vscode拓展的问题么?