代码规范配置文件

57 阅读1分钟

1、editorconfig 配置项

vscode 需要自行安装editorconfig 插件才能支持配置 .editorconfig 文件

.editorconfig 文件配置项:

# http://editorconfig.org
root = true

[*]
#缩进风格: tab
indent_style = tab
#缩进大小 使用tab_width
indent_size = 4
#tab 占据的宽度
tab_width = 4
#换行符lf
end_of_line = lf
#字符集utf-8
charset = utf-8
#是否删除行尾的空格
trim_trailing_whitespace = true
#是否在文件的最后插入一个空行
insert_final_newline = true

2、prettier 配置项

.prettierrc.js 文件配置项

暂时无效,还待研究解决

module.exports = {
    printWidth: 120,
    tabWidth: 3,
    useTabs: true,
    singleQuote: true, // 字符串使用单引号
    bracketSpacing: false,
    arrowParens: 'avoid',
};

优先级

editorconfig > prettierrc