Skip to content

Commit

Permalink
fix(config): adjust default TrailingCommentWidth to 1
Browse files Browse the repository at this point in the history
Change the default value of TrailingCommentWidth from 2 to 1 in the
FormatConfig struct and its corresponding test.

This matches Fastly's style. Fastly has standardized on one space for a
trailing comment, like gofmt, Prettier for JavaScript, rustfmt, and others:

https://www.fastly.com/documentation/guides/vcl/best-practices/#organize-and-comment-your-code
https://www.fastly.com/documentation/guides/vcl/using/#custom-vcl
  • Loading branch information
acme committed Jul 25, 2024
1 parent b62c25f commit 3381459
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type FormatConfig struct {

// Formatter options
IndentWidth int `yaml:"indent_width" default:"2"`
TrailingCommentWidth int `yaml:"trailing_comment_width" default:"2"`
TrailingCommentWidth int `yaml:"trailing_comment_width" default:"1"`
IndentStyle string `yaml:"indent_style" default:"space"`
LineWidth int `yaml:"line_width" default:"120"`
ExplicitStringConat bool `yaml:"explicit_string_concat" default:"false"`
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestConfigFromCLI(t *testing.T) {
},
Format: &FormatConfig{
IndentWidth: 2,
TrailingCommentWidth: 2,
TrailingCommentWidth: 1,
LineWidth: 120,
IndentStyle: "space",
ExplicitStringConat: false,
Expand Down

0 comments on commit 3381459

Please sign in to comment.