Skip to content

Commit 6e8dadb

Browse files
Rule sort-prop-types add noSortAlphabetically
Same as jsx-eslint#979
1 parent 9bd3456 commit 6e8dadb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/rules/sort-prop-types.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ module.exports = {
3434
ignoreCase: {
3535
type: 'boolean'
3636
},
37+
// Whether alphabetical sorting should be enforced
38+
noSortAlphabetically: {
39+
type: 'boolean'
40+
},
3741
sortShapeProp: {
3842
type: 'boolean'
3943
}
@@ -48,6 +52,7 @@ module.exports = {
4852
const requiredFirst = configuration.requiredFirst || false;
4953
const callbacksLast = configuration.callbacksLast || false;
5054
const ignoreCase = configuration.ignoreCase || false;
55+
const noSortAlphabetically = configuration.noSortAlphabetically || false;
5156
const sortShapeProp = configuration.sortShapeProp || false;
5257
const propWrapperFunctions = new Set(context.settings.propWrapperFunctions || []);
5358

@@ -216,7 +221,7 @@ module.exports = {
216221
}
217222
}
218223

219-
if (currentPropName < prevPropName) {
224+
if (!noSortAlphabetically && currentPropName < prevPropName) {
220225
context.report({
221226
node: curr,
222227
message: 'Prop types declarations should be sorted alphabetically',

0 commit comments

Comments
 (0)