|
1 | 1 | # EditorConfig — https://editorconfig.org |
2 | | -# Garante consistência de formatação independente do editor ou plugin |
| 2 | +# Garante consistência de formatação independente do editor, OS ou desenvolvedor. |
| 3 | +# Suportado nativamente pelo Cursor, VS Code, JetBrains, Vim, Neovim, Emacs e outros. |
| 4 | +# |
| 5 | +# Propriedades suportadas pela spec: |
| 6 | +# charset → encoding do arquivo |
| 7 | +# end_of_line → lf | crlf | cr |
| 8 | +# indent_style → space | tab |
| 9 | +# indent_size → número de espaços (ou "tab" para usar tab_width) |
| 10 | +# tab_width → largura visual do tab (default = indent_size) |
| 11 | +# trim_trailing_whitespace → remove espaços no fim de cada linha |
| 12 | +# insert_final_newline → garante newline no final do arquivo |
| 13 | +# max_line_length → limite de caracteres por linha (informativo p/ alguns editores) |
3 | 14 |
|
4 | 15 | root = true |
5 | 16 |
|
6 | | -# Regra padrão para todos os arquivos |
| 17 | +# ============================================================================= |
| 18 | +# PADRÃO GLOBAL — aplicado a tudo que não tem regra específica abaixo |
| 19 | +# ============================================================================= |
7 | 20 | [*] |
8 | | -charset = utf-8 |
9 | | -end_of_line = lf |
10 | | -indent_style = space |
11 | | -indent_size = 2 |
| 21 | +charset = utf-8 |
| 22 | +end_of_line = lf |
| 23 | +indent_style = space |
| 24 | +indent_size = 2 |
12 | 25 | trim_trailing_whitespace = true |
13 | | -insert_final_newline = true |
| 26 | +insert_final_newline = true |
| 27 | +max_line_length = 120 |
14 | 28 |
|
15 | | -# JavaScript e TypeScript |
| 29 | +# ============================================================================= |
| 30 | +# JAVASCRIPT E TYPESCRIPT |
| 31 | +# Inclui: módulos ESM (.mjs), CommonJS (.cjs), config files (.js/.ts) |
| 32 | +# Padrão: 2 espaços — Prettier e ESLint usam isso como base |
| 33 | +# max_line_length = 100: balanceio entre legibilidade e linha curta |
| 34 | +# ============================================================================= |
16 | 35 | [*.{js,jsx,ts,tsx,mjs,cjs}] |
17 | | -indent_size = 2 |
| 36 | +indent_size = 2 |
18 | 37 | max_line_length = 100 |
19 | 38 |
|
20 | | -# JSON |
21 | | -[*.{json,jsonc}] |
22 | | -indent_size = 2 |
| 39 | +# ============================================================================= |
| 40 | +# JSON E VARIANTES |
| 41 | +# package.json, tsconfig.json, .prettierrc, .eslintrc, etc. |
| 42 | +# max_line_length = 120: JSON pode ter strings longas em configs |
| 43 | +# ============================================================================= |
| 44 | +[*.{json,jsonc,json5}] |
| 45 | +indent_size = 2 |
| 46 | +max_line_length = 120 |
23 | 47 |
|
24 | | -# HTML |
| 48 | +# ============================================================================= |
| 49 | +# HTML / TEMPLATES |
| 50 | +# indent_size = 2: padrão web |
| 51 | +# max_line_length = 120: atributos HTML podem ser verbosos |
| 52 | +# ============================================================================= |
25 | 53 | [*.{html,htm}] |
26 | | -indent_size = 2 |
| 54 | +indent_size = 2 |
| 55 | +max_line_length = 120 |
27 | 56 |
|
28 | | -# CSS, SCSS, Tailwind |
29 | | -[*.{css,scss,less}] |
30 | | -indent_size = 2 |
| 57 | +# ============================================================================= |
| 58 | +# CSS / SASS / LESS |
| 59 | +# indent_size = 2: padrão para stylesheets |
| 60 | +# max_line_length = 100: regras CSS curtas são mais legíveis |
| 61 | +# ============================================================================= |
| 62 | +[*.{css,scss,sass,less}] |
| 63 | +indent_size = 2 |
| 64 | +max_line_length = 100 |
| 65 | + |
| 66 | +# ============================================================================= |
| 67 | +# PYTHON |
| 68 | +# indent_size = 4: PEP 8 obrigatório |
| 69 | +# max_line_length = 88: padrão do Black (não 79 do PEP 8 — Black é mais pragmático) |
| 70 | +# ============================================================================= |
| 71 | +[*.py] |
| 72 | +indent_size = 4 |
| 73 | +max_line_length = 88 |
| 74 | + |
| 75 | +# ============================================================================= |
| 76 | +# C# / .NET |
| 77 | +# indent_size = 4: convenção Microsoft e Roslyn |
| 78 | +# max_line_length = 120: padrão Microsoft C# coding guidelines |
| 79 | +# ============================================================================= |
| 80 | +[*.{cs,csx}] |
| 81 | +indent_size = 4 |
| 82 | +max_line_length = 120 |
| 83 | + |
| 84 | +# Arquivos de projeto .NET (XML-based) |
| 85 | +[*.{csproj,vbproj,fsproj,props,targets,ruleset}] |
| 86 | +indent_size = 2 |
| 87 | +max_line_length = 200 |
| 88 | + |
| 89 | +# ============================================================================= |
| 90 | +# SQL |
| 91 | +# indent_size = 2: mais compacto — queries aninhadas ficam legíveis |
| 92 | +# max_line_length = 120: CTEs e JOINs podem ser longos |
| 93 | +# ============================================================================= |
| 94 | +[*.{sql,pgsql,psql}] |
| 95 | +indent_size = 2 |
| 96 | +max_line_length = 120 |
| 97 | + |
| 98 | +# ============================================================================= |
| 99 | +# YAML |
| 100 | +# indent_size = 2: spec YAML exige consistência — 2 é o mais comum |
| 101 | +# max_line_length = 120: CI/CD pipelines têm valores longos |
| 102 | +# ATENÇÃO: YAML é sensível a tabs — nunca usar indent_style = tab aqui |
| 103 | +# ============================================================================= |
| 104 | +[*.{yml,yaml}] |
| 105 | +indent_style = space |
| 106 | +indent_size = 2 |
| 107 | +max_line_length = 120 |
| 108 | + |
| 109 | +# ============================================================================= |
| 110 | +# TOML |
| 111 | +# Usado por: Poetry (pyproject.toml), Cargo (Rust), configs modernas |
| 112 | +# indent_size = 2: padrão da comunidade TOML |
| 113 | +# ============================================================================= |
| 114 | +[*.toml] |
| 115 | +indent_size = 2 |
| 116 | +max_line_length = 120 |
31 | 117 |
|
32 | | -# Markdown — preserva trailing whitespace (usado para quebra de linha) |
| 118 | +# ============================================================================= |
| 119 | +# MARKDOWN |
| 120 | +# trim_trailing_whitespace = false: dois espaços no fim de linha = <br> em Markdown |
| 121 | +# — remover quebraria formatação intencional |
| 122 | +# max_line_length = off: textos podem ser longos; wrapping é responsabilidade do editor |
| 123 | +# ============================================================================= |
33 | 124 | [*.{md,mdx,mdc}] |
34 | 125 | trim_trailing_whitespace = false |
35 | | -indent_size = 2 |
| 126 | +indent_size = 2 |
| 127 | +max_line_length = off |
36 | 128 |
|
37 | | -# YAML (CI/CD, configs) |
38 | | -[*.{yml,yaml}] |
| 129 | +# ============================================================================= |
| 130 | +# XML / SVG / CONFIGURAÇÕES |
| 131 | +# indent_size = 2: mais compacto que 4 para arquivos de config |
| 132 | +# max_line_length = 200: atributos XML podem ser longos |
| 133 | +# ============================================================================= |
| 134 | +[*.{xml,svg,xaml,config,props}] |
| 135 | +indent_size = 2 |
| 136 | +max_line_length = 200 |
| 137 | + |
| 138 | +# ============================================================================= |
| 139 | +# VARIÁVEIS DE AMBIENTE |
| 140 | +# max_line_length = off: values de env podem ser longos (tokens, connection strings) |
| 141 | +# trim = true: espaços acidentais antes/depois do = causam bugs silenciosos |
| 142 | +# ============================================================================= |
| 143 | +[*.{env,env.example,env.local,env.development,env.production}] |
| 144 | +trim_trailing_whitespace = true |
| 145 | +max_line_length = off |
| 146 | + |
| 147 | +# ============================================================================= |
| 148 | +# SCRIPTS SHELL / BASH / ZSH |
| 149 | +# end_of_line = lf: scripts Unix SEMPRE precisam de LF — CRLF quebra o shebang |
| 150 | +# ============================================================================= |
| 151 | +[*.{sh,bash,zsh}] |
| 152 | +end_of_line = lf |
39 | 153 | indent_size = 2 |
40 | 154 |
|
41 | | -# Python (quando aplicável) |
42 | | -[*.py] |
| 155 | +# ============================================================================= |
| 156 | +# POWERSHELL |
| 157 | +# end_of_line = crlf: Windows-native — alguns cmdlets esperam CRLF |
| 158 | +# indent_size = 4: convenção da comunidade PowerShell e PSScriptAnalyzer |
| 159 | +# ============================================================================= |
| 160 | +[*.{ps1,psm1,psd1}] |
| 161 | +end_of_line = crlf |
43 | 162 | indent_size = 4 |
44 | | -max_line_length = 88 |
45 | 163 |
|
46 | | -# Makefiles precisam de tab |
| 164 | +# ============================================================================= |
| 165 | +# BATCH SCRIPTS WINDOWS (.bat, .cmd) |
| 166 | +# end_of_line = crlf: cmd.exe no Windows requer CRLF |
| 167 | +# ============================================================================= |
| 168 | +[*.{bat,cmd}] |
| 169 | +end_of_line = crlf |
| 170 | +indent_size = 4 |
| 171 | + |
| 172 | +# ============================================================================= |
| 173 | +# MAKEFILES |
| 174 | +# indent_style = tab: Makefiles exigem tab — espaços quebram o make |
| 175 | +# ============================================================================= |
47 | 176 | [Makefile] |
48 | 177 | indent_style = tab |
| 178 | +tab_width = 4 |
49 | 179 |
|
50 | | -# Scripts shell |
51 | | -[*.{sh,bash,bat}] |
52 | | -end_of_line = lf |
| 180 | +# ============================================================================= |
| 181 | +# DOCKER |
| 182 | +# ============================================================================= |
| 183 | +[Dockerfile] |
| 184 | +indent_size = 4 |
| 185 | + |
| 186 | +[*.{dockerignore,gitignore,npmignore,eslintignore,prettierignore}] |
| 187 | +trim_trailing_whitespace = true |
| 188 | + |
| 189 | +# ============================================================================= |
| 190 | +# CONFIGURAÇÕES DE FERRAMENTAS (sem regras especiais além do padrão global) |
| 191 | +# Declarados explicitamente para documentar que foram considerados |
| 192 | +# ============================================================================= |
| 193 | +[*.{prettierrc,eslintrc,stylelintrc,babelrc,browserslistrc}] |
| 194 | +indent_size = 2 |
0 commit comments