Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change reported range to only the identifier #2314

Merged
merged 1 commit into from
Jun 21, 2019
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