# https://editorconfig.org
root = true

# -----------------------------------------------------------------------------
# Defaults
# -----------------------------------------------------------------------------
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
max_line_length = 120

# -----------------------------------------------------------------------------
# Python
# -----------------------------------------------------------------------------
[*.py]
indent_size = 4
max_line_length = 120

[*.pyi]
indent_size = 4
max_line_length = 120

[*.pyw]
indent_size = 4

# -----------------------------------------------------------------------------
# Config / data (usually 2-space)
# -----------------------------------------------------------------------------
[*.{yml,yaml}]
indent_size = 2

[*.toml]
indent_size = 2

[*.json]
indent_size = 2

[*.jsonc]
indent_size = 2

[*.json5]
indent_size = 2

[{.eslintrc,.babelrc,.stylelintrc,.prettierrc,.botorcc,jest.config,*.bowerrc,*.jsb3,*.jsb2}]
indent_size = 2

[*.{ini,cfg,conf}]
indent_size = 4

[*.env]
indent_size = 4
trim_trailing_whitespace = false

[*.env.*]
indent_size = 4
trim_trailing_whitespace = false

# -----------------------------------------------------------------------------
# Docs / markup
# -----------------------------------------------------------------------------
[*.md]
indent_size = 2
# Trailing spaces can mean hard line breaks in Markdown.
trim_trailing_whitespace = false
max_line_length = off

[*.mdx]
indent_size = 2
trim_trailing_whitespace = false
max_line_length = off

[*.rst]
indent_size = 3
trim_trailing_whitespace = false

[*.adoc]
indent_size = 2
trim_trailing_whitespace = false

[*.txt]
indent_size = 4
trim_trailing_whitespace = true

[*.html]
indent_size = 2

[*.htm]
indent_size = 2

[*.css]
indent_size = 2

[*.scss]
indent_size = 2

[*.sass]
indent_size = 2
indent_style = space

[*.less]
indent_size = 2

[*.svg]
indent_size = 2

# -----------------------------------------------------------------------------
# JavaScript / TypeScript / frontend
# -----------------------------------------------------------------------------
[*.{js,cjs,mjs,jsx}]
indent_size = 2
max_line_length = 120

[*.{ts,cts,mts,tsx}]
indent_size = 2
max_line_length = 120

[*.vue]
indent_size = 2
max_line_length = 120

[*.svelte]
indent_size = 2
max_line_length = 120

[*.js.map]
indent_size = 2

# -----------------------------------------------------------------------------
# Shell / Docker / Make / CI
# -----------------------------------------------------------------------------
[*.{sh,bash,zsh,ksh}]
indent_size = 2

[Dockerfile]
indent_size = 4

[Dockerfile*]
indent_size = 4

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

[Makefile]
indent_style = tab
indent_size = 4

[GNUmakefile]
indent_style = tab
indent_size = 4

[*.mk]
indent_style = tab
indent_size = 4

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

# -----------------------------------------------------------------------------
# Windows scripts (keep CRLF)
# -----------------------------------------------------------------------------
[*.{bat,cmd,ps1}]
end_of_line = crlf

[*.bat]
indent_style = space
indent_size = 4

[*.cmd]
indent_style = space
indent_size = 4

[*.ps1]
indent_style = space
indent_size = 4

# -----------------------------------------------------------------------------
# SQL / database
# -----------------------------------------------------------------------------
[*.{sql,ddl}]
indent_size = 2

# -----------------------------------------------------------------------------
# Java / Kotlin / Groovy / XML family
# -----------------------------------------------------------------------------
[*.{java,kt,kts,groovy,gradle}]
indent_size = 4
continuation_indent_size = 8
max_line_length = 120

[*.{xml,xsd,xsl,xslt,wsdl,wsdd,wadl,tld,jnlp,fxml,pom,ant,xul,rng,xjb,jrxml,plan,jhm}]
indent_size = 2

[*.{mod,ent,dtd,elt}]
indent_size = 2

# -----------------------------------------------------------------------------
# Go / Rust / C-family (common defaults)
# -----------------------------------------------------------------------------
[*.go]
indent_style = tab
indent_size = 4

[*.rs]
indent_size = 4
max_line_length = 100

[*.{c,h,cpp,hpp,cc,hh,cxx,hxx}]
indent_size = 4

[*.{m,mm}]
indent_size = 4

# -----------------------------------------------------------------------------
# Misc project files
# -----------------------------------------------------------------------------
[*.gradle.kts]
indent_size = 4

[*.properties]
indent_size = 4

[*.graphql]
indent_size = 2

[*.proto]
indent_size = 2

[*.tf]
indent_size = 2

[*.hcl]
indent_size = 2

[*.nix]
indent_size = 2

[*.lock]
indent_size = 2
insert_final_newline = true

[*.diff]
trim_trailing_whitespace = false

[*.patch]
trim_trailing_whitespace = false

# Binary / generated: avoid editors "fixing" them
[*.{png,jpg,jpeg,gif,ico,webp,pdf,xlsx,xls,whl,gz,zip,pyc,class,jar,so,dylib,dll,exe}]
charset = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset
indent_size = unset
