Skip to content

Commit

Permalink
Disable fix for jsx-sort-default-props
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Sutton committed Nov 26, 2019
1 parent 1fa28a8 commit 3fd20a2
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 213 deletions.
2 changes: 0 additions & 2 deletions docs/rules/jsx-sort-default-props.md
Expand Up @@ -2,8 +2,6 @@

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.

**Fixable:** This rule is automatically fixable using the `--fix` flag on the command line.

## Rule Details

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.
Expand Down
14 changes: 7 additions & 7 deletions lib/rules/jsx-sort-default-props.js
Expand Up @@ -8,7 +8,7 @@
const variableUtil = require('../util/variable');
const docsUrl = require('../util/docsUrl');
const propWrapperUtil = require('../util/propWrapper');
const propTypesSortUtil = require('../util/propTypesSort');
// const propTypesSortUtil = require('../util/propTypesSort');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -23,7 +23,7 @@ module.exports = {
url: docsUrl('jsx-sort-default-props')
},

fixable: 'code',
// fixable: 'code',

schema: [{
type: 'object',
Expand Down Expand Up @@ -100,9 +100,9 @@ module.exports = {
* @returns {void}
*/
function checkSorted(declarations) {
function fix(fixer) {
return propTypesSortUtil.fixPropTypesSort(fixer, context, declarations, ignoreCase);
}
// function fix(fixer) {
// return propTypesSortUtil.fixPropTypesSort(fixer, context, declarations, ignoreCase);
// }

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

return prev;
Expand Down

0 comments on commit 3fd20a2

Please sign in to comment.