-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Addressing the comment and issue of people use a lot of editors and very different versions
, which is a valid concern—one good approach to handling this is using EditorConfig.
EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.
Applying a strictly enforced style can be challenging without a universal solution. .editorconfig
provides a way to configure the editor out of the box, making it easier to maintain consistency. The project supports many different editors, including IntelliJ, Eclipse, and VS Code. On IntelliJ, for example, it works by default, following the convention over configuration principle.
Many projects face similar issues, so it makes sense to adopt a widely used and well-supported solution as well.
Examples of projects using .editorconfig
:
Relevant discussion:
This is the config representing the rules enforced by checkstyle:
[*]
charset = utf-8
end_of_line = lf
ij_continuation_indent_size = 4
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 100
[*.xml]
indent_size = 2
[pom.xml]
max_line_length = 140
[*.java]
ij_java_class_count_to_use_import_on_demand = 999
ij_java_else_on_new_line = true
ij_java_imports_layout = $*, |, java.**, |, javax.**, |, org.**, |, net.**, |, com.**, |, *
ij_java_names_count_to_use_import_on_demand = 999
[**xdocs-examples**.java]
ij_continuation_indent_size = 2
indent_size = 2
https://editorconfig.org/#pre-installed