其他分享
首页 > 其他分享> > vue项目中的.editorconfig是做什么的

vue项目中的.editorconfig是做什么的

作者:互联网

多人开发的大型vue项目中,项目的根路径会有个“.editorconfig”的配置文件,如下:

# https://editorconfig.org
# 告诉EditorConfig插件,这是根文件,不用继续往上查找
root = true

[*] # 匹配全部文件
# 设置字符集
charset = utf-8
# 缩进风格,可选"space"、"tab"
indent_style = space
# 缩进的空格数
indent_size = 4
# 结尾换行符,可选"lf"、"cr"、"crlf"
end_of_line = lf 
# 在文件结尾插入新行
insert_final_newline = true
# 删除一行中的前后空格
trim_trailing_whitespace = true

# 匹配所有的md文件
[*.md]

# 匹配js和py结尾的文件
[*.{js,py}]


 

什么是EditorConfig?

多人开发的项目中,开发者会使用自己习惯使用的编辑器、IDE工具,editorconfig配置用于强制使用这套基本代码的所有开发者使用统一的编码风格、样式。

 

注意事项

编辑 EditorConfig 文件后,必须重载代码文件,新设置才会生效。

需要配合编辑器对应的插件使用,VScode对应的插件名为EditorConfig for VS Code

windows用户如果无法创建.editorconfig文件的情况下,可以先创建.editorconfig.,系统会自动重命名为.editorconfig文件。

editorconfig文件配置优先级是从上到下,先定义的规则优先级比后定义的要高。

 

标签:文件,插件,vue,结尾,项目,EditorConfig,true,editorconfig
来源: https://www.cnblogs.com/nicolelhh/p/15783847.html