Skip to content

Commit

Permalink
Rule sort-prop-types add noSortAlphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau authored Jul 23, 2018
1 parent 9bd3456 commit 6e8dadb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rules/sort-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ module.exports = {
ignoreCase: {
type: 'boolean'
},
// Whether alphabetical sorting should be enforced
noSortAlphabetically: {
type: 'boolean'
},
sortShapeProp: {
type: 'boolean'
}
Expand All @@ -48,6 +52,7 @@ module.exports = {
const requiredFirst = configuration.requiredFirst || false;
const callbacksLast = configuration.callbacksLast || false;
const ignoreCase = configuration.ignoreCase || false;
const noSortAlphabetically = configuration.noSortAlphabetically || false;
const sortShapeProp = configuration.sortShapeProp || false;
const propWrapperFunctions = new Set(context.settings.propWrapperFunctions || []);

Expand Down Expand Up @@ -216,7 +221,7 @@ module.exports = {
}
}

if (currentPropName < prevPropName) {
if (!noSortAlphabetically && currentPropName < prevPropName) {
context.report({
node: curr,
message: 'Prop types declarations should be sorted alphabetically',
Expand Down

0 comments on commit 6e8dadb

Please sign in to comment.