useSortedKeys
Since: v1.9.0
Description
Section titled DescriptionSorts the keys of a JSON object in natural order
Examples
Section titled Examples{ "vase": "fancy", "nested": { "omega": "bar", "alpha": "foo" }}
code-block.json ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
1 1 │ {
2 │ - ····“vase”:·“fancy”,
3 │ - ····“nested”:·{
2 │ + ····“nested”:·{
4 3 │ “omega”: “bar”,
5 4 │ “alpha”: “foo”
6 │ - ····}
5 │ + ····},
6 │ + ····“vase”:·“fancy”
7 7 │ }
8 8 │
code-block.json ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
2 2 │ “vase”: “fancy”,
3 3 │ “nested”: {
4 │ - ········“omega”:·“bar”,
5 │ - ········“alpha”:·“foo”
4 │ + ········“alpha”:·“foo”,
5 │ + ········“omega”:·“bar”
6 6 │ }
7 7 │ }
How to configure
Section titled How to configure{ "linter": { "rules": { "source": { "useSortedKeys": "error" } } }}