Skip to content

Instantly share code, notes, and snippets.

@morisono
Forked from vikas-parmar/.editorconfig
Created June 16, 2025 23:47
Show Gist options
  • Save morisono/71a4e9aa56644a4ac5b1e5e932876c49 to your computer and use it in GitHub Desktop.
Save morisono/71a4e9aa56644a4ac5b1e5e932876c49 to your computer and use it in GitHub Desktop.
This .editorconfig file is designed to ensure consistent coding standards across different editors and IDEs. It helps maintain uniform indentation, line endings, and encoding, preventing unnecessary formatting changes when working in a team.
# This is the root .editorconfig file, meaning all settings here take precedence.
root = true
# Global settings for all file types
[*]
# Use UTF-8 encoding for better character support
charset = utf-8
# Enforce LF (Line Feed) as the default line ending for cross-platform compatibility
end_of_line = lf
# Remove trailing whitespace on save to prevent unnecessary diffs
trim_trailing_whitespace = true
# Ensure a newline at the end of every file to prevent formatting issues
insert_final_newline = true
# Use spaces instead of tabs for indentation
indent_style = space
# Set indentation to 2 spaces (common standard for web development)
indent_size = 2
# Enforce a maximum line length of 100 characters for readability
max_line_length = 100
# Special rules for Markdown files
[*.md]
# Do not trim trailing whitespace, as it is sometimes necessary for lists
trim_trailing_whitespace = false
# No max line length restriction in Markdown to allow flexible formatting
max_line_length = off
# Special rules for JSON and YAML files
[*.{json,yml,yaml}]
# Always use 2-space indentation for readability
indent_size = 2
# Enforce a max line length of 100 characters
max_line_length = 100
# Special rules for JavaScript, TypeScript, and JSX/TSX files
[*.{js,jsx,ts,tsx}]
# Follow project standards with 2-space indentation
indent_size = 2
# Use single quotes where applicable (only applies in some editors)
quote_type = single
# Enforce a max line length of 100 characters
max_line_length = 100
# Special rules for CSS, SCSS, and Less files
[*.{css,scss,less}]
# Use 2-space indentation
indent_size = 2
# Enforce a max line length of 100 characters
max_line_length = 100
# Special rules for HTML and XML files
[*.{html,xml}]
# Use 2-space indentation for consistency
indent_size = 2
# Allow a slightly longer max line length (120 characters) for readability
max_line_length = 120
# Ignore formatting for package-lock.json and other auto-generated lock files
[package-lock.json]
# No max line length restriction since these files are machine-generated
max_line_length = off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment