Skip to content

Commit fcf9d7b

Browse files
github-actions[bot]github-actionsGudahtt
authored
4.0.0 (#205)
* 4.0.0 * Update changelog --------- Co-authored-by: github-actions <[email protected]> Co-authored-by: Mark Stacey <[email protected]>
1 parent cb69326 commit fcf9d7b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [4.0.0]
10+
### Changed
11+
- **BREAKING**: Drop support for Node.js v16 ([#203](https://github.com/Gudahtt/prettier-plugin-sort-json/pull/203))
12+
- **BREAKING**: Update case insensitive sort to use deterministic key order ([#189](https://github.com/Gudahtt/prettier-plugin-sort-json/pull/189))
13+
- Previously the "case insensitive" sorting options would leave keys in their original order when they differed only in case. They have been updated to sort identical keys in case order instead, making these sort options deterministic.
14+
- This change has been made because deterministic sort orders tend to be easier to work with, are more aligned with how Prettier works, and typically lead to less churn. However, if your project needs to preserve original key order, you can emulate the old behavior by defining a custom sort order that has a category for each case-insensitive character. For example, you could set this as your `prettierrc.js` file:
15+
```JavaScript prettierrc.js
16+
{
17+
jsonSortOrder: JSON.stringify({
18+
'/^[Aa]/': 'none',
19+
'/^[Bb]/': 'none',
20+
'/^[Cc]/': 'none',
21+
...
22+
'/^[Zz]/': 'none',
23+
})
24+
}
25+
```
26+
This should work for small character sets. If you require case-insensitive sorting with a larger character set, please submit a feature request. We can bring back the old sorting order as an option if there is demand for it.
27+
928
## [3.1.0]
1029
### Added
1130
- Add `none` sorting algorithm ([#177](https://github.com/Gudahtt/prettier-plugin-sort-json/pull/177))
@@ -60,7 +79,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6079
### Added
6180
- Initial release
6281

63-
[Unreleased]: https://github.com/Gudahtt/prettier-plugin-sort-json/compare/v3.1.0...HEAD
82+
[Unreleased]: https://github.com/Gudahtt/prettier-plugin-sort-json/compare/v4.0.0...HEAD
83+
[4.0.0]: https://github.com/Gudahtt/prettier-plugin-sort-json/compare/v3.1.0...v4.0.0
6484
[3.1.0]: https://github.com/Gudahtt/prettier-plugin-sort-json/compare/v3.0.1...v3.1.0
6585
[3.0.1]: https://github.com/Gudahtt/prettier-plugin-sort-json/compare/v3.0.0...v3.0.1
6686
[3.0.0]: https://github.com/Gudahtt/prettier-plugin-sort-json/compare/v2.0.0...v3.0.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "prettier-plugin-sort-json",
3-
"version": "3.1.1",
3+
"version": "4.0.0",
44
"description": "Prettier plugin to sort JSON files alphanumerically by key",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)