Skip to content

Commit 74bf02b

Browse files
committed
fix: Windows json sort diff
Signed-off-by: Innei <i@innei.in>
1 parent 9b1de77 commit 74bf02b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugins/eslint/eslint-recursive-sort.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ export default {
3636
const sortedJson = sortObjectKeys(json)
3737
const sortedText = `${JSON.stringify(sortedJson, null, 2)}\n`
3838

39-
if (text.trim() !== sortedText.trim()) {
39+
const noWhiteSpaceDiff = (a, b) =>
40+
a.replaceAll(/\s/g, "") === b.replaceAll(/\s/g, "")
41+
42+
if (!noWhiteSpaceDiff(text, sortedText)) {
4043
context.report({
4144
node,
4245
message: "JSON keys are not sorted recursively",

0 commit comments

Comments
 (0)