.editorconfig说明

是什么

.editorconfig是 EditorConfig.org提出的规范,主要用于在不同编辑器及IDE中提供代码一致性。例如缩进、换行、编码等

谁在用

常见于github上的项目,包括bootstrap、angular,html5-boilerplate 等明星项目都在使用。

有谁资瓷

包括WebStorm、Atom、Visual Studio(Code)、xcode等都支持,部分通过插件支持

怎么用

本质上是一个配置文件,并且是基于ini。官网有一个简单的例子,直接搬运过来

# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file(会从目录一级级查找,直到找到root=true的文件)
root = true

# Unix-style newlines with a newline ending every file(换行符,还有cr\crlf)
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8

# 4 space indentation
[*.py]
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

更多

官网
wiki

你可能感兴趣的:(.editorconfig说明)