We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
编辑器另外一个很重要的功能就是代码格式化了,VS Code默认提供常见文件的格式化,如.js,.html等。
.js
.html
.vue
这里我们添加对.vue文件的格式化支持。
{ "vetur.format.defaultFormatter": { "html": "prettier", "css": "prettier", "postcss": "prettier", "scss": "prettier", "less": "prettier", "js": "prettier", "ts": "prettier", "stylus": "stylus-supremacy" } }
这里是设置 Vetur 默认使用的格式化插件 prettier。 这样对于.vue文件中的 html 和 javascript 代码都有格式化支持了。
prettier
html
javascript
.eslintrc
js
"prettier.eslintIntegration": true
eslint
参考资料:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
编辑器另外一个很重要的功能就是代码格式化了,VS Code默认提供常见文件的格式化,如
.js
,.html
等。添加对
.vue
文件的格式化支持这里我们添加对
.vue
文件的格式化支持。这里是设置 Vetur 默认使用的格式化插件
prettier
。 这样对于.vue
文件中的html
和javascript
代码都有格式化支持了。使用符合 ESLint 规范的格式化
prettier
格式化.js
文件可以设置
prettier
在格式化的时候,读取项目的.eslintrc
的配置,对js
代码进行格式化。prettier
插件.vue
文件的格式化prettier
插件对.vue
文件格式化时,暂不能支持将eslint
规范应用到js
代码中。但是我们可以先将其格式化,然后利用 ESLint 保存文件时自动修复错误的特性,修复一些诸如 分号,空格,缩进 等错误。
参考资料:
The text was updated successfully, but these errors were encountered: