File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package commands
22
33import (
44 "fmt"
5+ "slices"
56 "sort"
67 "strings"
78
@@ -106,8 +107,20 @@ func (c *helpCommand) printPresets() {
106107}
107108
108109func printLinters (lcs []* linter.Config ) {
109- sort .Slice (lcs , func (i , j int ) bool {
110- return lcs [i ].Name () < lcs [j ].Name ()
110+ slices .SortFunc (lcs , func (a , b * linter.Config ) int {
111+ if a .IsDeprecated () && b .IsDeprecated () {
112+ return strings .Compare (a .Name (), b .Name ())
113+ }
114+
115+ if a .IsDeprecated () {
116+ return 1
117+ }
118+
119+ if b .IsDeprecated () {
120+ return - 1
121+ }
122+
123+ return strings .Compare (a .Name (), b .Name ())
111124 })
112125
113126 for _ , lc := range lcs {
Original file line number Diff line number Diff line change 55 "os"
66 "path/filepath"
77 "reflect"
8+ "slices"
89 "sort"
910 "strings"
1011 "unicode"
@@ -53,6 +54,22 @@ func getLintersListMarkdown(enabled bool) string {
5354 return neededLcs [i ].Name < neededLcs [j ].Name
5455 })
5556
57+ slices .SortFunc (neededLcs , func (a , b * types.LinterWrapper ) int {
58+ if a .IsDeprecated () && b .IsDeprecated () {
59+ return strings .Compare (a .Name , b .Name )
60+ }
61+
62+ if a .IsDeprecated () {
63+ return 1
64+ }
65+
66+ if b .IsDeprecated () {
67+ return - 1
68+ }
69+
70+ return strings .Compare (a .Name , b .Name )
71+ })
72+
5673 lines := []string {
5774 "|Name|Description|Presets|AutoFix|Since|" ,
5875 "|---|---|---|---|---|---|" ,
Original file line number Diff line number Diff line change @@ -45,3 +45,7 @@ type LinterWrapper struct {
4545 Since string `json:"since,omitempty"`
4646 Deprecation * Deprecation `json:"deprecation,omitempty"`
4747}
48+
49+ func (l * LinterWrapper ) IsDeprecated () bool {
50+ return l .Deprecation != nil
51+ }
You can’t perform that action at this time.
0 commit comments