.editorconfig配置学习

146 阅读1分钟

.editorconfig配置统一编辑器配置

EditorConfig 官网地址editorconfig.org/

匹配全部文件 [*]
[*.{js,jsx,ts,tsx,vue}]

 一、常用属性配置
 
1、root <boolean>   是否是顶级配置文件,设置为 true 的时候才会停止搜索.editorconfig 文件

2、charset <"latin" | "utf-8" | "utf-8-bom" | "utf-16be" | "utf-16le">    编码格式

3、indent_style <"tab" | "space">    缩进方式

4、indent_size <number>    缩进大小

5、end_of_line<"lf" | "cr" | "crlf">  换行符类型

6、insert_final_newline <boolean>    是否让文件以空行结束

7、trim_trailing_whitespace <boolean>    是否删除行尾空格

8、max_line_length <number>   最大行宽。

二、常用文件名匹配

1、*   匹配除/之外的任意字符

2、**  匹配任意字符串

3、?   匹配任意单个字符

4、[name]   匹配 name 字符

5、[!name]  不匹配 name 字符

6、[s1,s2,s3]   匹配给定的字符串

7、[num1..num2]   匹配 num1 到 mun2 直接的整数