Skip to content

vue/no-side-effects-in-computed-properties ​

禁止计算属性中的副作用

  • ⚙️ 此规则包含在 "plugin:vue/essential"、*.configs["flat/essential"]、"plugin:vue/vue2-essential"、*.configs["flat/vue2-essential"]、"plugin:vue/strongly-recommended"、*.configs["flat/strongly-recommended"]、"plugin:vue/vue2-strongly-recommended"、*.configs["flat/vue2-strongly-recommended"]、"plugin:vue/recommended"、*.configs["flat/recommended"]、"plugin:vue/vue2-recommended" 和 *.configs["flat/vue2-recommended"] 中。

📖 规则详情 ​

此规则旨在防止代码在计算属性和函数中产生副作用。

¥This rule is aimed at preventing the code which makes side effects in computed properties and functions.

在计算属性和函数中引入副作用被认为是一种非常糟糕的做法。它使代码变得不可预测且难以理解。

¥It is considered a very bad practice to introduce side effects inside computed properties and functions. It makes the code not predictable and hard to understand.

Now loading...
Now loading...
Now loading...
Now loading...

🔧选项 ​

¥🔧 Options

无。

¥Nothing.

📚扩展阅读 ​

¥📚 Further Reading

🚀版本 ​

¥🚀 Version

此规则在 eslint-plugin-vue v3.6.0 中引入

¥This rule was introduced in eslint-plugin-vue v3.6.0

🔍代码实现 ​

¥🔍 Implementation

eslint-plugin-vue v10.4 中文网 - 粤ICP备13048890号