# 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 = tab

[*.{sh,bash}]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
# shfmt: --language-variant
shell_variant = bash
# shfmt: forces binary operators like &&, ||, etc  on a new line
binary_next_line = false
# shfmt: --case-indent (ensures patterns are indented deeper than the case statement)
switch_case_indent = true
# shfmt: place a space between a redirection char and the file/descriptor
space_redirects = true
# shfmt: control whether extra spaces used for manual alignment are preserved
keep_padding = true
# shfmt: forces the opening brace of a function to a new line
function_next_line = false

[[shell]]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
# shfmt: --language-variant
shell_variant = posix
# shfmt: forces binary operators like &&, ||, etc  on a new line
binary_next_line = false
# shfmt: --case-indent (ensures patterns are indented deeper than the case statement)
switch_case_indent = true
# shfmt: place a space between a redirection char and the file/descriptor
space_redirects = true
# shfmt: control whether extra spaces used for manual alignment are preserved
keep_padding = true
# shfmt: forces the opening brace of a function to a new line
function_next_line = false

[[bash]]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
# shfmt: --language-variant
shell_variant = bash
# shfmt: forces binary operators like &&, ||, etc  on a new line
binary_next_line = false
# shfmt: --case-indent (ensures patterns are indented deeper than the case statement)
switch_case_indent = true
# shfmt: place a space between a redirection char and the file/descriptor
space_redirects = true
# shfmt: control whether extra spaces used for manual alignment are preserved
keep_padding = true
# shfmt: forces the opening brace of a function to a new line
function_next_line = false

# 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

# Ignore the entire "DirName" directory when calling shfmt on directories,
# such as "shfmt -l -w .". When formatting files directly,
# like "shfmt -w third_party/foo.sh" or "shfmt --filename=third_party/foo.sh",
# the ignore logic is applied only when the --apply-ignore flag is given.
[DirName/**]
ignore = true

