Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/rules/jsx-sort-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ module.exports = {
}
if (!previousIsReserved && currentIsReserved) {
context.report({
node: decl,
node: decl.name,
message: 'Reserved props must be listed before all other props',
fix: generateFixerFunction(node, context, reservedList)
});
Expand All @@ -306,7 +306,7 @@ module.exports = {
if (previousIsCallback && !currentIsCallback) {
// Encountered a non-callback prop after a callback prop
context.report({
node: memo,
node: memo.name,
message: 'Callbacks must be listed after all other props',
fix: generateFixerFunction(node, context, reservedList)
});
Expand All @@ -320,7 +320,7 @@ module.exports = {
}
if (!currentValue && previousValue) {
context.report({
node: memo,
node: memo.name,
message: 'Shorthand props must be listed before all other props',
fix: generateFixerFunction(node, context, reservedList)
});
Expand All @@ -334,7 +334,7 @@ module.exports = {
}
if (currentValue && !previousValue) {
context.report({
node: memo,
node: memo.name,
message: 'Shorthand props must be listed after all other props',
fix: generateFixerFunction(node, context, reservedList)
});
Expand All @@ -344,7 +344,7 @@ module.exports = {

if (!noSortAlphabetically && currentPropName < previousPropName) {
context.report({
node: decl,
node: decl.name,
message: 'Props should be sorted alphabetically',
fix: generateFixerFunction(node, context, reservedList)
});
Expand Down
10 changes: 5 additions & 5 deletions tests/lib/rules/jsx-sort-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ const ruleTester = new RuleTester({parserOptions});

const expectedError = {
message: 'Props should be sorted alphabetically',
type: 'JSXAttribute'
type: 'JSXIdentifier'
};
const expectedCallbackError = {
message: 'Callbacks must be listed after all other props',
type: 'JSXAttribute'
type: 'JSXIdentifier'
};
const expectedShorthandFirstError = {
message: 'Shorthand props must be listed before all other props',
type: 'JSXAttribute'
type: 'JSXIdentifier'
};
const expectedShorthandLastError = {
message: 'Shorthand props must be listed after all other props',
type: 'JSXAttribute'
type: 'JSXIdentifier'
};
const expectedReservedFirstError = {
message: 'Reserved props must be listed before all other props',
type: 'JSXAttribute'
type: 'JSXIdentifier'
};
const expectedEmptyReservedFirstError = {
message: 'A customized reserved first list must not be empty'
Expand Down