1515# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1616# Common editor configurations for this project.
1717#
18- # EditorConfig defines a file format for specifying some common coding style
19- # parameters. Many IDEs and editors read .editorconfig files, either natively
20- # or via plugins. A few formatters also read .editorconfig; shfmt and Prettier
21- # are two examples (as of early 2025).
22- #
18+ # EditorConfig is a file format for specifying some common style parameters.
19+ # Many IDEs & editors read .editorconfig files, either natively or via plugins.
2320# We mostly follow Google's style guides (https://google.github.io/styleguide/)
24- # with very few deviations.
25- #
26- # Miscellaneous notes:
27- #
28- # - The EditorConfig property `max_line_length` is not set here because its
29- # intended behavior is poorly specified. (See the discussion in the comments
30- # at https://github.com/editorconfig/editorconfig/issues/387) It *would* have
31- # been desirable to define a project convention for the line width here, but
32- # we must instead use editor-specific configuration files to do that.
33- #
34- # - With one known exception (shfmt), `.editorconfig` files are not read by
35- # linters or formatters, which means the project needs separate config files
36- # for those tools.
21+ # with only a few deviations for line length and indentation in some files.
3722# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3823
3924root = true
@@ -43,51 +28,28 @@ charset = utf-8
4328indent_style = space
4429insert_final_newline = true
4530spelling_language = en-US
46- # It would be preferable not to set tab_width, but some EditorConfig plugins
47- # (e.g., Emacs's) set it equal to indent_size if it's not set otherwise.
48- tab_width = 8
49- # Trailing whitespace on lines is almost always noise. An exception is in
50- # Markdown, where two spaces = line break; however, that's such a foot-gun in
51- # practice that we avoid it. So, it's okay to set this next value globally.
5231trim_trailing_whitespace = true
32+ max_line_length = 80
5333
54- [{BUILD,* .BUILD,* .bzl,* .bazel} ]
34+ [{BUILD,* .BUILD,* .bzl,* .bazel,.bazelrc } ]
5535# Google doesn't have a style guideline for Bazel files. Most people use 4.
5636indent_size = 4
5737
5838[{* .cc,* .h} ]
59- # This matches Google style guidelines.
60- indent_size = 2
61-
62- [{* .ts,* .js} ]
63- # This matches Google style guidelines.
39+ # Google style guidelines use 2.
6440indent_size = 2
6541
6642[* .json ]
6743# Not stated explicitly in Google's guidelines, but the examples use 2.
6844indent_size = 2
6945
7046[* .py ]
71- # This matches Google style guidelines.
47+ # Google style guidelines use 4 .
7248indent_size = 4
7349
74- [* .rst ]
75- # Google doesn't have a style guideline for reStructuredText. Many people use 3.
76- indent_size = 3
77-
7850[* .sh ]
79- # This matches Google style guidelines.
51+ # Google style guidelines use 2 .
8052indent_size = 2
81- # The following are used by shfmt. These bring it closer to Google's style.
82- binary_next_line = true
83- shell_variant = bash
84- space_redirects = true
85- switch_case_indent = true
86-
87- # If this repository has a "third_party" directory, ignore it entirely.
88- # Note: shfmt also respects this if you run it with --appply-ignore.
89- [third_party/** ]
90- ignore = true
9153
9254[{* .yaml,* .yml} ]
9355# Google doesn't have style guidelines for YAML. Most people use indent = 2.
0 commit comments