Skip to content

Commit

Permalink
Improve error range for vue/max-props (#2532)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevsommer committed Aug 20, 2024
1 parent 705d262 commit 0fbe35e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/rules/max-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
function checkMaxNumberOfProps(props) {
if (props.length > option.maxProps && props[0].node) {
context.report({
node: props[0].node,
node: props[0].node.parent,
messageId: 'tooManyProps',
data: {
propCount: props.length,
Expand Down
9 changes: 6 additions & 3 deletions tests/lib/rules/max-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ tester.run('max-props', rule, {
errors: [
{
message: 'Component has too many props (2). Maximum allowed is 1.',
line: 3
line: 3,
endLine: 3
}
]
},
Expand All @@ -133,7 +134,8 @@ tester.run('max-props', rule, {
errors: [
{
message: 'Component has too many props (2). Maximum allowed is 1.',
line: 5
line: 4,
endLine: 7
}
]
},
Expand All @@ -154,7 +156,8 @@ tester.run('max-props', rule, {
errors: [
{
message: 'Component has too many props (3). Maximum allowed is 2.',
line: 3
line: 3,
endLine: 3
}
]
}
Expand Down

0 comments on commit 0fbe35e

Please sign in to comment.