microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
.editorconfig
218lines · modecode
| 1 | # EditorConfig helps maintain consistent coding styles and settings |
| 2 | # across different editors and IDEs. This file is automatically recognized |
| 3 | # by most modern editors (VS Code, WebStorm, Sublime Text, etc.) |
| 4 | # See: https://editorconfig.org/ |
| 5 | |
| 6 | # Top-most EditorConfig file - Stop searching in parent directories |
| 7 | root = true |
| 8 | |
| 9 | # Default settings for all files |
| 10 | [*] |
| 11 | # Character encoding (UTF-8 is standard for modern projects) |
| 12 | charset = utf-8 |
| 13 | |
| 14 | # Line ending style (auto will use system default) |
| 15 | # - "lf" for Unix-like systems (Linux, macOS) |
| 16 | # - "crlf" for Windows |
| 17 | # - "auto" for mixed environments (recommended for projects with mixed OS users) |
| 18 | end_of_line = auto |
| 19 | |
| 20 | # Insert a newline at the end of every file |
| 21 | insert_final_newline = true |
| 22 | |
| 23 | # Remove trailing whitespace from all lines |
| 24 | trim_trailing_whitespace = true |
| 25 | |
| 26 | # ============================================================================ |
| 27 | # TypeScript and JavaScript Files (Main source code) |
| 28 | # Matches: .ts, .tsx, .js, .jsx, .mjs |
| 29 | # Configured to match package.json prettier config: tabWidth = 4 |
| 30 | # ============================================================================ |
| 31 | [*.{ts,tsx,js,jsx,mjs}] |
| 32 | indent_style = space |
| 33 | indent_size = 4 |
| 34 | |
| 35 | # ============================================================================ |
| 36 | # JSON Files |
| 37 | # Includes: package.json, tsconfig.json, *.json files |
| 38 | # Using 4 spaces for consistency with TypeScript files |
| 39 | # ============================================================================ |
| 40 | [*.json] |
| 41 | indent_style = space |
| 42 | indent_size = 4 |
| 43 | |
| 44 | # ============================================================================ |
| 45 | # JSON with Comments (like tsconfig.json comments) |
| 46 | # Some tools support .jsonc extension for JSON with comments |
| 47 | # ============================================================================ |
| 48 | [*.jsonc] |
| 49 | indent_style = space |
| 50 | indent_size = 4 |
| 51 | |
| 52 | # ============================================================================ |
| 53 | # Markdown Files (.md) |
| 54 | # Configured to match prettier override: tabWidth = 2 |
| 55 | # See package.json > prettier > overrides > files: ["*.md"] |
| 56 | # ============================================================================ |
| 57 | [*.md] |
| 58 | indent_style = space |
| 59 | indent_size = 2 |
| 60 | trim_trailing_whitespace = false |
| 61 | |
| 62 | # Note: Markdown may have intentional trailing whitespace for line breaks (two spaces), |
| 63 | # so we disable trim_trailing_whitespace for .md files to preserve intentional formatting |
| 64 | |
| 65 | # ============================================================================ |
| 66 | # YAML Files (.yml, .yaml) |
| 67 | # Used in GitHub Actions (.github/workflows/*.yml) and CI configuration |
| 68 | # Standard is 2 spaces for YAML files |
| 69 | # ============================================================================ |
| 70 | [*.{yml,yaml}] |
| 71 | indent_style = space |
| 72 | indent_size = 2 |
| 73 | |
| 74 | # ============================================================================ |
| 75 | # Shell Script Files |
| 76 | # Includes bash, sh scripts |
| 77 | # Standard is 2-4 spaces (using 2 for compatibility) |
| 78 | # ============================================================================ |
| 79 | [*.{sh,bash}] |
| 80 | indent_style = space |
| 81 | indent_size = 2 |
| 82 | |
| 83 | # ============================================================================ |
| 84 | # Batch and PowerShell Files |
| 85 | # Used for build scripts (prepareBuild.bat, PowerShell scripts) |
| 86 | # ============================================================================ |
| 87 | [*.{bat,cmd,ps1}] |
| 88 | indent_style = space |
| 89 | indent_size = 4 |
| 90 | |
| 91 | # ============================================================================ |
| 92 | # XML Files |
| 93 | # Includes: .vscodeignore (VS Code manifest), test result files (.xml) |
| 94 | # ============================================================================ |
| 95 | [*.xml] |
| 96 | indent_style = space |
| 97 | indent_size = 2 |
| 98 | |
| 99 | # ============================================================================ |
| 100 | # Configuration Files (.cfg, .conf, .config) |
| 101 | # Generic configuration files |
| 102 | # ============================================================================ |
| 103 | [*.{cfg,conf,config}] |
| 104 | indent_style = space |
| 105 | indent_size = 4 |
| 106 | |
| 107 | # ============================================================================ |
| 108 | # Property Files (.properties) |
| 109 | # Java property files and similar |
| 110 | # ============================================================================ |
| 111 | [*.properties] |
| 112 | indent_style = space |
| 113 | indent_size = 4 |
| 114 | |
| 115 | # ============================================================================ |
| 116 | # Make Files |
| 117 | # Unix Makefiles (must use tabs, not spaces) |
| 118 | # WARNING: Do not change indent_style or indent_size for Makefiles! |
| 119 | # ============================================================================ |
| 120 | [Makefile] |
| 121 | indent_style = tab |
| 122 | |
| 123 | # ============================================================================ |
| 124 | # Git-related Files |
| 125 | # .gitignore, .gitattributes, etc. |
| 126 | # Keep them simple and readable |
| 127 | # ============================================================================ |
| 128 | [.git*] |
| 129 | indent_style = space |
| 130 | indent_size = 2 |
| 131 | |
| 132 | # ============================================================================ |
| 133 | # Documentation Files |
| 134 | # Include LICENSE, README, CONTRIBUTING, etc. |
| 135 | # ============================================================================ |
| 136 | [LICENSE*] |
| 137 | insert_final_newline = false |
| 138 | indent_style = space |
| 139 | |
| 140 | [README*] |
| 141 | indent_style = space |
| 142 | indent_size = 2 |
| 143 | |
| 144 | [CONTRIBUTING*] |
| 145 | indent_style = space |
| 146 | indent_size = 2 |
| 147 | |
| 148 | [CHANGELOG*] |
| 149 | indent_style = space |
| 150 | indent_size = 2 |
| 151 | |
| 152 | # ============================================================================ |
| 153 | # Build and Package Files |
| 154 | # gulpfile.js, webpack.config.js, etc. |
| 155 | # ============================================================================ |
| 156 | [gulpfile.js] |
| 157 | indent_style = space |
| 158 | indent_size = 4 |
| 159 | |
| 160 | [webpack.config.js] |
| 161 | indent_style = space |
| 162 | indent_size = 4 |
| 163 | |
| 164 | # ============================================================================ |
| 165 | # Test Files |
| 166 | # Matches test configuration and support files |
| 167 | # ============================================================================ |
| 168 | [test/**/*.{ts,js}] |
| 169 | indent_style = space |
| 170 | indent_size = 4 |
| 171 | |
| 172 | [test/**/*.json] |
| 173 | indent_style = space |
| 174 | indent_size = 4 |
| 175 | |
| 176 | [*.test.{ts,tsx,js,jsx}] |
| 177 | indent_style = space |
| 178 | indent_size = 4 |
| 179 | |
| 180 | # ============================================================================ |
| 181 | # i18n (Internationalization) Files |
| 182 | # Language-specific JSON files |
| 183 | # ============================================================================ |
| 184 | [i18n/**/*.json] |
| 185 | indent_style = space |
| 186 | indent_size = 4 |
| 187 | |
| 188 | # ============================================================================ |
| 189 | # SPECIAL NOTES |
| 190 | # ============================================================================ |
| 191 | |
| 192 | # 1. SYNCHRONIZATION WITH PRETTIER |
| 193 | # This .editorconfig file is synchronized with prettier config in package.json: |
| 194 | # - Default indent_size: 4 (matches prettier.tabWidth) |
| 195 | # - Markdown indent_size: 2 (matches prettier.overrides[0].options.tabWidth) |
| 196 | # - end_of_line: auto (matches prettier.endOfLine) |
| 197 | # - insert_final_newline: true (recommended practice) |
| 198 | # - trim_trailing_whitespace: true (enforced by ESLint) |
| 199 | |
| 200 | # 2. SYNCHRONIZATION WITH ESLINT |
| 201 | # ESLint rules are also configured consistently with this EditorConfig. |
| 202 | # Most importantly: |
| 203 | # - No conflicting indentation rules between tools |
| 204 | # - Consistent line ending handling |
| 205 | # - Trailing whitespace removal is enforced |
| 206 | |
| 207 | # 3. EDITOR SETUP |
| 208 | # For VS Code, install the "EditorConfig for VS Code" extension: |
| 209 | # https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig |
| 210 | # |
| 211 | # Other editors (WebStorm, Sublime Text, Vim, etc.) have built-in or plugin support. |
| 212 | |
| 213 | # 4. TROUBLESHOOTING |
| 214 | # If your editor doesn't respect .editorconfig: |
| 215 | # - Ensure the extension/plugin is installed |
| 216 | # - Reload the editor after installing |
| 217 | # - Check that .editorconfig is in the project root (root = true) |
| 218 | # - Some settings may require manual editor configuration as backup |
| 219 | |