Skip to content

Commit

Permalink
Fix false positives for call expression in no-mutating-props rule. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jul 30, 2021
1 parent 1c99bcd commit 7664259
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils/index.js
Expand Up @@ -1706,7 +1706,7 @@ module.exports = {
const callName = getStaticPropertyName(mem)
if (
callName &&
/^push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill$/u.exec(
/^(?:push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill)$/u.exec(
callName
)
) {
Expand Down
13 changes: 13 additions & 0 deletions tests/lib/rules/no-mutating-props.js
Expand Up @@ -318,6 +318,19 @@ ruleTester.run('no-mutating-props', rule, {
value.value++
</script>
`
},
{
// https://github.com/vuejs/eslint-plugin-vue/issues/1579
filename: 'test.vue',
code: `
<script>
export default {
props: ['prop'],
setup(props) {
props.prop.sortAscending()
}
}
</script>`
}
],

Expand Down

0 comments on commit 7664259

Please sign in to comment.