美文网首页
前端自动代码格式化

前端自动代码格式化

作者: Epat | 来源:发表于2023-06-11 11:49 被阅读0次

1. webstrom

image.png
1. 进入webstrom中的.prettierrc.js文件中,右键选中apply prettier code style rules选项
image.png
2.进入webstrom中的.eslintrc.js文件中,右键选中apply eslint code style rules选项
image.png
3. 在webstorm设置中,Tools > Actions on save 中选中 Run eslint --fix 和 Run prettier 保存即可

2. vscode

image.png
1. 安裝prettier插件
image.png
2. 打开设置搜索save,选中format on save
image.png
3. 右键选择Format Document with,选中configure Default Formatter,
选中 prettier 作为默认的格式化插件

注意这里vscode中我好像无法对eslint 做处理,如果有知道的可以补充进来

相关文章

网友评论

      本文标题:前端自动代码格式化

      本文链接:https://www.haomeiwen.com/subject/tpixydtx.html