项目搭建(项目格式化)
2022-01-10 本文已影响0人
BJ呀呀呀
一.创建 .editorconfig文件(统一每个人的代码格式化风格,vscode中需要装插件editorconfig)
# http://editorconfig.org
root = true
# 对所有文件生效
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# 对后缀名为 md 的文件生效
[*.md]
max_line_length=off
trim_trailing_whitespace = false
二.统一开发中的prettier风格 (1.需要在开发环境中安装prettier)
image.png2.创建.prettierrc文件
{
"useTabs": false,
"tabwidth":2,
"printWidth": 80,
"semi": false,
"singleQuote": false,
"trailingComma":"none"
}
3.创建prettierigonre忽略文件
/dist/*
.local
.output.js
/node_modules/**
**/*.svg
**/*.sh
/public/*
4插件安装
5.配置 通过命令格式化所有的文件
image.png
6.命令
image.png