安装prettier
npm install --save-dev --save-exact prettier
执行命令
npx prettier --write --end-of-line lf .
即可将项目中的所有文件行尾序列格式改为lf
*在你使用git拉取代码的时候,git会自动将代码当中与你当前系统不同的换行方式转化成你当前系统的换行方式,从而造成这种冲突。
window系统解决办法:
修改git全局配置,禁止git自动将lf转换成crlf, 命令:
git config --global core.autocrlf false
vscode设置搜索Eol
在设置里Eol 选\n 即可默认为LF