Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

세상에는 다양한 editor 와 IDE 가 있고 여러 개의 encoding 이 존재합니다.

어떤 OS 는 줄 바꿈을 의미하는 개행 문자를 LF(line feed) 만 쓰고 어떤 OS 는 CR + LF 를 쓰기도 합니다.


코딩은 협업이기 때문에 사용하는 도구는 취향대로 써도 되지만 작성하는 코드는 표준을 만들고 이를 준수해야 합니다.


예로 누구는 개행을 LF 로 쓰고 누구는 CR + LF 로 쓴다면 한 쪽에서 커밋한 소스를 다른 쪽에서 내려받는다면 CR + LF 문제로 인해 변경한 게 없어도 모두 변경해야 한다고 나올수 있습니다.


누구는 tab 을 tab 으로 쓰고 누구는 space 4칸, 다른 이는 space 2칸을 쓴다면 다른 이의 작업을 내려받으면 내 PC 에서는 늘 변경되었다고 표시되고 커밋 대상으로 나올겁니다.


EditorConfig 는 이렇게 Editor, OS, encoding 으로 인해 소스 코드의 일관성이 깨지는 문제를 해결하기 위한 표준으로 character encoding, 개행 처리 방법, 들여쓰기 방법(tab인지 space 인지) 등을 정의하고 , 사용하는 



# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file 
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

# 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 

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



Ref

  • No labels