Skip to content

Commit 7664259

Browse files
authored
Fix false positives for call expression in no-mutating-props rule. (#1584)
1 parent 1c99bcd commit 7664259

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Diff for: lib/utils/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ module.exports = {
17061706
const callName = getStaticPropertyName(mem)
17071707
if (
17081708
callName &&
1709-
/^push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill$/u.exec(
1709+
/^(?:push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill)$/u.exec(
17101710
callName
17111711
)
17121712
) {

Diff for: tests/lib/rules/no-mutating-props.js

+13
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,19 @@ ruleTester.run('no-mutating-props', rule, {
318318
value.value++
319319
</script>
320320
`
321+
},
322+
{
323+
// https://github.com/vuejs/eslint-plugin-vue/issues/1579
324+
filename: 'test.vue',
325+
code: `
326+
<script>
327+
export default {
328+
props: ['prop'],
329+
setup(props) {
330+
props.prop.sortAscending()
331+
}
332+
}
333+
</script>`
321334
}
322335
],
323336

0 commit comments

Comments
 (0)