From 76642595fb519336d8baeca24ab3fa0e953bb8f6 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Fri, 30 Jul 2021 12:04:46 +0900 Subject: [PATCH] Fix false positives for call expression in no-mutating-props rule. (#1584) --- lib/utils/index.js | 2 +- tests/lib/rules/no-mutating-props.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/utils/index.js b/lib/utils/index.js index 510e016a5..bce6ccea4 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -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 ) ) { diff --git a/tests/lib/rules/no-mutating-props.js b/tests/lib/rules/no-mutating-props.js index 2dcc68c5b..c0d6c2736 100644 --- a/tests/lib/rules/no-mutating-props.js +++ b/tests/lib/rules/no-mutating-props.js @@ -318,6 +318,19 @@ ruleTester.run('no-mutating-props', rule, { value.value++ ` + }, + { + // https://github.com/vuejs/eslint-plugin-vue/issues/1579 + filename: 'test.vue', + code: ` + ` } ],