You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The option receives multiple objects with the following properties:
84
+
85
+
-`pathPattern` (Required) ... Defines the regular expression pattern of paths to which you want to enforce the order. If you want to apply to the top level, define `"^$"`.
86
+
-`hasProperties` ... Defines an array of property names. Checks only objects that have the defined properties.
87
+
-`order` (Required) ... Defines how to enforce the order. You can use an object or an array.
88
+
- Array ... Defines an array of properties to enforce the order.
89
+
- Object ... The object has the following properties:
90
+
-`type`:
91
+
-`"asc"` ... Enforce properties to be in ascending order. This is default.
92
+
-`"desc"` ... Enforce properties to be in descending order.
93
+
-`caseSensitive` ... If `true`, enforce properties to be in case-sensitive order. Default is `true`.
94
+
-`natural` ... If `true`, enforce properties to be in natural order. Default is `false`.
95
+
-`minKeys` ... Specifies the minimum number of keys that an object should have in order for the object's unsorted keys to produce an error. Default is `2`, which means by default all objects with unsorted keys will result in lint errors.
96
+
97
+
You can also define options in the same format as the [sort-keys] rule.
98
+
99
+
```json5
100
+
{
101
+
"jsonc/sort-keys": ["error",
102
+
"asc",
103
+
{
104
+
"caseSensitive":true,
105
+
"natural":false,
106
+
"minKeys":2
107
+
}
108
+
]
109
+
}
110
+
```
111
+
112
+
See [here](https://eslint.org/docs/rules/sort-keys#options) for details.
0 commit comments