-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.go
More file actions
88 lines (78 loc) · 2.28 KB
/
options.go
File metadata and controls
88 lines (78 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package fracturedjson
// CommentPolicy controls how comments in input are handled.
type CommentPolicy int
const (
CommentTreatAsError CommentPolicy = iota
CommentRemove
CommentPreserve
)
// EolStyle controls line endings in output.
type EolStyle int
const (
EolDefault EolStyle = iota
EolCRLF
EolLF
)
// NumberListAlignment controls number alignment mode.
type NumberListAlignment int
const (
NumberLeft NumberListAlignment = iota
NumberRight
NumberDecimal
NumberNormalize
)
// TableCommaPlacement controls comma position in table formatting.
type TableCommaPlacement int
const (
CommaBeforePadding TableCommaPlacement = iota
CommaAfterPadding
CommaBeforePaddingExceptNumbers
)
// Options controls FracturedJson formatting behavior.
type Options struct {
JsonEolStyle EolStyle
MaxTotalLineLength int
MaxInlineComplexity int
MaxCompactArrayComplexity int
MaxTableRowComplexity int
MaxPropNamePadding int
ColonBeforePropNamePadding bool
TableCommaPlacement TableCommaPlacement
MinCompactArrayRowItems int
AlwaysExpandDepth int
NestedBracketPadding bool
SimpleBracketPadding bool
ColonPadding bool
CommaPadding bool
CommentPadding bool
NumberListAlignment NumberListAlignment
IndentSpaces int
UseTabToIndent bool
PrefixString string
CommentPolicy CommentPolicy
PreserveBlankLines bool
AllowTrailingCommas bool
}
// RecommendedOptions returns the v5-style default options.
func RecommendedOptions() Options {
return Options{
JsonEolStyle: EolDefault,
MaxTotalLineLength: 120,
MaxInlineComplexity: 2,
MaxCompactArrayComplexity: 2,
MaxTableRowComplexity: 2,
MaxPropNamePadding: 16,
TableCommaPlacement: CommaBeforePaddingExceptNumbers,
MinCompactArrayRowItems: 3,
AlwaysExpandDepth: -1,
NestedBracketPadding: true,
SimpleBracketPadding: false,
ColonPadding: true,
CommaPadding: true,
CommentPadding: true,
NumberListAlignment: NumberDecimal,
IndentSpaces: 4,
CommentPolicy: CommentTreatAsError,
AllowTrailingCommas: false,
}
}