Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
  • Loading branch information
FlareZh and ota-meshi committed May 10, 2023
1 parent 1949eaa commit eebafd1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/rules/no-mutating-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,11 @@ module.exports = {
)
const isRootProps = !!node.name && propsInfo.name === node.name
const parent = node.parent
const parentProperty =
parent.type === 'MemberExpression' ? parent.property : null
const name =
isRootProps && parentProperty?.type === 'Identifier'
? parentProperty.name
: node.name
(isRootProps &&
parent.type === 'MemberExpression' &&
utils.getStaticPropertyName(parent)) ||
node.name
if (name && (propsInfo.set.has(name) || isRootProps)) {
verifyMutating(node, name, isRootProps)
}
Expand Down

0 comments on commit eebafd1

Please sign in to comment.