diff --git a/lib/rules/jsx-sort-props.js b/lib/rules/jsx-sort-props.js
index d6e5a982ef..7528c1905c 100644
--- a/lib/rules/jsx-sort-props.js
+++ b/lib/rules/jsx-sort-props.js
@@ -107,7 +107,7 @@ const generateFixerFunction = (node, context, reservedList) => {
});
});
- fixers.sort((a, b) => a.range[0] < b.range[0]);
+ fixers.sort((a, b) => b.range[0] - a.range[0]);
const rangeStart = fixers[fixers.length - 1].range[0];
const rangeEnd = fixers[0].range[1];
diff --git a/tests/lib/rules/jsx-sort-props.js b/tests/lib/rules/jsx-sort-props.js
index 2f32e6b2ac..082ef11f4e 100644
--- a/tests/lib/rules/jsx-sort-props.js
+++ b/tests/lib/rules/jsx-sort-props.js
@@ -238,6 +238,101 @@ ruleTester.run('jsx-sort-props', rule, {
`,
errors: 3
},
+ {
+ code: '',
+ output: '',
+ errors: 1
+ },
+ {
+ code: `
`,
+ output: `
`,
+ errors: 10
+ },
+ {
+ code: ``,
+ output: ``,
+ errors: 13
+ },
{
code: '',
errors: [expectedShorthandLastError],