vue3的项目之前一直使用的是iconfont字体图标库,未出现eslint报错的问题。

最新更新了一下图标,将新的图标代码放到项目里突然发现eslint的报错提醒,具体如下:

 1:70214  error  'c' is assigned to itself  no-self-assign

✖ 1 problem (1 error, 0 warnings)

其实这个报错很简单,主要看关键提醒就行no-self-assign,查一下eslint的文档就知道
Disallow assignments where both sides are exactly the same
根据官方给出的配置是

This rule has the option to check properties as well.

{
   "no-self-assign": ["error", {"props": true}]
}
props - if this is true, no-self-assign rule warns self-assignments of properties. Default is true.

但是这样的配置,在项目中貌似没有生效;
后来索性直接在.eslintrc.js文件中配置off,重启npm项目,则无错误提醒;

"no-self-assign": "off"
Logo

前往低代码交流专区

更多推荐