Skip to content

Commit 3fd20a2

Browse files
author
Roy Sutton
committed
Disable fix for jsx-sort-default-props
1 parent 1fa28a8 commit 3fd20a2

File tree

3 files changed

+211
-213
lines changed

3 files changed

+211
-213
lines changed

docs/rules/jsx-sort-default-props.md

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
Some developers prefer to sort `defaultProps` declarations alphabetically to be able to find necessary declarations easier at a later time. Others feel that it adds complexity and becomes a burden to maintain.
44

5-
**Fixable:** This rule is automatically fixable using the `--fix` flag on the command line.
6-
75
## Rule Details
86

97
This rule checks all components and verifies that all `defaultProps` declarations are sorted alphabetically. A spread attribute resets the verification. The default configuration of the rule is case-sensitive.

lib/rules/jsx-sort-default-props.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
const variableUtil = require('../util/variable');
99
const docsUrl = require('../util/docsUrl');
1010
const propWrapperUtil = require('../util/propWrapper');
11-
const propTypesSortUtil = require('../util/propTypesSort');
11+
// const propTypesSortUtil = require('../util/propTypesSort');
1212

1313
// ------------------------------------------------------------------------------
1414
// Rule Definition
@@ -23,7 +23,7 @@ module.exports = {
2323
url: docsUrl('jsx-sort-default-props')
2424
},
2525

26-
fixable: 'code',
26+
// fixable: 'code',
2727

2828
schema: [{
2929
type: 'object',
@@ -100,9 +100,9 @@ module.exports = {
100100
* @returns {void}
101101
*/
102102
function checkSorted(declarations) {
103-
function fix(fixer) {
104-
return propTypesSortUtil.fixPropTypesSort(fixer, context, declarations, ignoreCase);
105-
}
103+
// function fix(fixer) {
104+
// return propTypesSortUtil.fixPropTypesSort(fixer, context, declarations, ignoreCase);
105+
// }
106106

107107
declarations.reduce((prev, curr, idx, decls) => {
108108
if (/Spread(?:Property|Element)$/.test(curr.type)) {
@@ -120,8 +120,8 @@ module.exports = {
120120
if (currentPropName < prevPropName) {
121121
context.report({
122122
node: curr,
123-
message: 'Default prop types declarations should be sorted alphabetically',
124-
fix
123+
message: 'Default prop types declarations should be sorted alphabetically'
124+
// fix
125125
});
126126

127127
return prev;

0 commit comments

Comments
 (0)