File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ To lint a message, you can use any one of the following
147147## Default Config
148148
149149``` yaml
150- version : v0.9.0
150+ min- version : v0.9.0
151151formatter : default
152152rules :
153153- header-min-length
Original file line number Diff line number Diff line change @@ -26,8 +26,7 @@ func Parse(confPath string) (*lint.Config, error) {
2626 }
2727
2828 conf := & lint.Config {
29- MinVersion : internal .Version (),
30- Formatter : (& formatter.DefaultFormatter {}).Name (),
29+ Formatter : (& formatter.DefaultFormatter {}).Name (),
3130 Severity : lint.SeverityConfig {
3231 Default : lint .SeverityError ,
3332 },
@@ -38,6 +37,17 @@ func Parse(confPath string) (*lint.Config, error) {
3837 return nil , fmt .Errorf ("config file error: %w" , err )
3938 }
4039
40+ // Backward compatibility: accept old "version" key
41+ if conf .MinVersion == "" && conf .DeprecatedVersion != "" {
42+ conf .MinVersion = conf .DeprecatedVersion
43+ }
44+ conf .DeprecatedVersion = ""
45+
46+ // Default to current version if neither key was provided
47+ if conf .MinVersion == "" {
48+ conf .MinVersion = internal .Version ()
49+ }
50+
4151 if conf .Formatter == "" {
4252 return nil , errors .New ("config error: formatter is empty" )
4353 }
Original file line number Diff line number Diff line change @@ -16,7 +16,11 @@ type SeverityConfig struct {
1616type Config struct {
1717 // MinVersion is the minimum version of commitlint required
1818 // should be in semver format
19- MinVersion string `yaml:"version"`
19+ MinVersion string `yaml:"min-version"`
20+
21+ // DeprecatedVersion is the old "version" key, kept for backward compatibility.
22+ // Use MinVersion ("min-version") in new config files.
23+ DeprecatedVersion string `yaml:"version,omitempty"`
2024
2125 // Formatter of the lint result
2226 Formatter string `yaml:"formatter"`
You can’t perform that action at this time.
0 commit comments