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 few exceptions (e.g., shfmt), `.editorconfig` files are not read by
35- # linters or formatters, which means the project needs separate config files
36- # for those tools. This includes markdownlint, yamllint, and others.
21+ # with only a few deviations for line length and indentation in some files.
3722# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3823
3924root = true
@@ -43,32 +28,27 @@ 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 = 100
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.
39+ # Google style guidelines use 2 .
6040indent_size = 2
6141
62- [{* .ts ,* .js } ]
63- # This matches Google style guidelines.
42+ [{* .js ,* .ts } ]
43+ # Google style guidelines use 2 .
6444indent_size = 2
6545
6646[* .json ]
6747# Not stated explicitly in Google's guidelines, but the examples use 2.
6848indent_size = 2
6949
7050[* .py ]
71- # This matches Google style guidelines.
51+ # Google style guidelines use 4 .
7252indent_size = 4
7353
7454[* .rst ]
@@ -78,16 +58,6 @@ indent_size = 3
7858[* .sh ]
7959# Google style guidelines use 2.
8060indent_size = 4
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
9161
9262[{* .yaml,* .yml} ]
9363# Google doesn't have style guidelines for YAML. Most people use indent = 2.
0 commit comments