15
15
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16
16
# Common editor configurations for this project.
17
17
#
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.
23
20
# 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.
37
22
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
23
39
24
root = true
@@ -43,32 +28,27 @@ charset = utf-8
43
28
indent_style = space
44
29
insert_final_newline = true
45
30
spelling_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.
52
31
trim_trailing_whitespace = true
32
+ max_line_length = 100
53
33
54
- [{BUILD,* .BUILD,* .bzl,* .bazel} ]
34
+ [{BUILD,* .BUILD,* .bzl,* .bazel,.bazelrc } ]
55
35
# Google doesn't have a style guideline for Bazel files. Most people use 4.
56
36
indent_size = 4
57
37
58
38
[{* .cc,* .h} ]
59
- # This matches Google style guidelines.
39
+ # Google style guidelines use 2 .
60
40
indent_size = 2
61
41
62
- [{* .ts ,* .js } ]
63
- # This matches Google style guidelines.
42
+ [{* .js ,* .ts } ]
43
+ # Google style guidelines use 2 .
64
44
indent_size = 2
65
45
66
46
[* .json ]
67
47
# Not stated explicitly in Google's guidelines, but the examples use 2.
68
48
indent_size = 2
69
49
70
50
[* .py ]
71
- # This matches Google style guidelines.
51
+ # Google style guidelines use 4 .
72
52
indent_size = 4
73
53
74
54
[* .rst ]
@@ -78,16 +58,6 @@ indent_size = 3
78
58
[* .sh ]
79
59
# Google style guidelines use 2.
80
60
indent_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
91
61
92
62
[{* .yaml,* .yml} ]
93
63
# Google doesn't have style guidelines for YAML. Most people use indent = 2.
0 commit comments