2.3 KiB
2.3 KiB
title | description | published | date | tags | editor | dateCreated |
---|---|---|---|---|---|---|
Code Standards | Using .editorconfig | true | 2024-05-06T20:22:26.149Z | markdown | 2024-05-05T18:30:37.455Z |
Global
Start your .editorconfig
file with this:
root = true
[*]
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true
indent_style = tabs
And add any additional types you need from below, making sure to separate each section with a new line.
Programming Languages
Nix
Using nixfmt-rfc-style
[*.nix]
indent_size = 2
insert_final_newline = false
indent_style = space
Python
Using pycodestyle
[*.{py,py3}]
indent_size = 4
indent_style = space
Node.js
Using prettier
[*.{cjs,mjs,js,ts,jsx,tsx}]
indent_size = 2
Rust
Using cargo fmt
[*.rs,Cargo.toml]
indent_size = 4
insert_final_newline = false
C and Related
[*.{c,cpp,cs,h,hpp,C,H,cxx,hxx}]
indent_size = 4
[*.{sln,csproj,vbproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
Shell Script
[*.{sh,zsh,bash,bat,cmd,ps1,psm1}]
indent_size = 4
Markup Languages
Markdown
[*.md]
indent_size = 2
trim_trailing_whitespace = false
insert_final_newline = false
Web
[*.{htm,html,less,svg,vue}]
indent_size = 2
[*.{css.sass,scss,less}]
indent_size = 2
Data Storage Files
JSON, YAML
[*.{json,json5,yaml,yml,webmanifest}]
indent_size = 2
TOML
[*.toml]
indent_style = unset
indent_size = 0
*RC
[.*rc]
indent_size = 2
CSV
[*.csv]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_size = 0
indent_style = unset
Lockfile
[*.lock]
indent_style = unset
insert_final_newline = unset
Git
[*.{diff,patch}]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_size = unset
indent_style = unset
[.{gitignore,gitreview,gitmodules}]
indent_style = unset
indent_size = 0
Keys
[*.{asc,key,ovpn,pem}]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
Build Tool Files
Make
[Makefile]
indent_style = tab