wiki/contributing/formatting/code.md

90 lines
1.2 KiB
Markdown
Raw Normal View History

2024-05-05 18:30:39 +00:00
---
title: .editorconfig
description: Formatting standards using .editorconfig
published: true
date: 2024-05-05T19:24:31.374Z
2024-05-05 18:30:39 +00:00
tags:
editor: markdown
dateCreated: 2024-05-05T18:30:37.455Z
---
# Standardization
2024-05-05 18:36:10 +00:00
These .editorconfig files are broken down into language specific sections.
Always include this global portion:
2024-05-05 18:30:39 +00:00
```editorconfig
root = true
[*]
2024-05-05 18:36:10 +00:00
charset = utf-8
2024-05-05 18:30:39 +00:00
trim_trailing_whitespace = true
end_of_line = lf
2024-05-05 19:07:12 +00:00
insert_final_newline = true
indent_style = space
2024-05-05 18:36:10 +00:00
```
---
2024-05-05 19:07:12 +00:00
# Programming Languages
2024-05-05 18:36:10 +00:00
## Nix
2024-05-05 19:07:12 +00:00
Using nixfmt-rfc-style
2024-05-05 18:36:10 +00:00
```editorconfig
[*.nix]
2024-05-05 19:07:12 +00:00
indent_size = 2
insert_final_newline = false
```
## Python
Using pycodestyle
```editorconfig
[*.{py,py3}]
indent_size = 4
```
## Node.js
Using prettier
```editorconfig
[*.{cjs,mjs,js,ts,jsx,tsx}]
indent_size = 2
```
## Rust
Using cargo fmt
```editorconfig
[*.rs,Cargo.toml]
indent_size = 4
2024-05-05 18:36:10 +00:00
insert_final_newline = false
2024-05-05 19:07:12 +00:00
```
# Markup Languages
## Markdown
```editorconfig
[*.md]
indent_size = 2
trim_trailing_whitespace = false
insert_final_newline = false
```
2024-05-05 19:07:12 +00:00
# Data Storage Files
## JSON
```editorconfig
[*.{json,json5}]
indent_size = 2
```
## CSV
```editorconfig
[*.csv]
indent_size = 0
```
# Build Tool Files
## Make
```
[Makefile]
indent_style = tab
2024-05-05 18:30:39 +00:00
```