Skip to content

Instantly share code, notes, and snippets.

@beeyev
Last active October 2, 2023 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beeyev/da5a065d01a506d0b3d42e794f7aadf9 to your computer and use it in GitHub Desktop.
Save beeyev/da5a065d01a506d0b3d42e794f7aadf9 to your computer and use it in GitHub Desktop.
editorconfig best practice
# EditorConfig
# https://gist.github.com/beeyev/da5a065d01a506d0b3d42e794f7aadf9
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
[*.{php,css,scss}]
indent_style = space
indent_size = 4
# Bazel: https://bazel.build/
# https://github.com/bazelbuild/buildtools/blob/master/BUILD.bazel
[*.{bazel,bzl}]
indent_size = 4
indent_style = space
[*.{yml,yaml,sls}]
indent_style = space
indent_size = 2
[*.{neon,neon.dist}]
indent_style = tab
indent_size = 4
[{*.cjsx,*.coffee}]
indent_size = 2
tab_width = 2
[*.{md,markdown,txt}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
[{Makefile,Caddyfile,*.Caddyfile,.gitconfig,.gitconfig.local}]
indent_style = tab
tab_width = 4
# Python
# https://www.python.org/dev/peps/pep-0008/#code-lay-out
[*.py]
indent_size = 4
indent_style = space
# Shell
# https://google.github.io/styleguide/shell.xml#Indentation
[*.{bash,sh,zsh}]
indent_size = 2
indent_style = space
# Go
# https://golang.org/cmd/gofmt/
[{go.mod,*.go}]
indent_style = tab
[{Dockerfile,Dockerfile.template.erb,Dockerfile-alpine}]
indent_style = space
indent_size = 4
[*.env]
insert_final_newline = false
trim_trailing_whitespace = false
# JavaScript, JSON, JSX, JavaScript Modules, TypeScript
# https://github.com/feross/standard
[*.{cjs,js,json,jsx,mjs,ts,tsx}]
indent_size = 2
indent_style = space
[*.{xml,xml.dist,xsd}]
max_line_length = off
end_of_line = lf
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_size = 2
# TOML
# https://github.com/toml-lang/toml/tree/master/examples
[*.toml]
indent_size = 2
indent_style = space
[*.{tf,tfvars,hcl,nomad}]
indent_size = 2
indent_style = space
[composer.json]
indent_style = space
indent_size = 4
[*.{diff,patch}]
insert_final_newline = false
trim_trailing_whitespace = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment