gpt4 book ai didi

javascript - react : expected an assignment or function call and instead saw an expression no-unused-expressions

转载 作者:行者123 更新时间:2023-12-03 08:28:42 34 4
gpt4 key购买 nike

我在我的 react 应用程序中使用第 3 方库“FoamTree”来进行树可视化。当我在我的组件中导入它的文件“carrotsearch.foamtree.js”时,它在多行中给了我这个错误:

Expected an assignment or function call and instead saw an expression  no-unused-expressions

它在普通的 Javascript 中运行良好。只有在 react 中导入时才会出错
该文件中有很多行给我这个错误。我分享的很少:
this.j = function (m, k) {
var f = a[m];
f || (f = [], a[m] = f);
f.push(k);
};
 function m(a) {
var d = a.O,
c = a.Sb[0].length - 1;
a.Ib[c] && (d.setLineDash(a.Ib[c]), d.Uj = a.Ld[c]);
d.miterLimit = a.Qd[c];
d.lineWidth = a.Md[c];
d.shadowBlur = a.ie[c];
d.shadowOffsetX = a.je[c];
d.shadowOffsetY = a.ke[c];
d.font = a.Nc[c].replace("#SIZE#", a.hc[c].toString());

}
for (e = 0; e < g; e++) {
h = c[e].kd, m[h.index] = !0, 0 > r * (h.x - k.x) + s * (h.y - k.y) + l * (h.z - k.z) && a.d(b, h);
}
 this.kc = function (a, b) {
D.V(b) || (n[a] = b, m(a));
return n[a];
};

编辑:
当我更改此 block 时:
this.kc = function (a, b) {
D.V(b) || (n[a] = b, m(a));
return n[a];
};

对此:
  this.kc = function (a, b) {
if( D.V(b) || (n[a] = b, m(a)) ){
return n[a];
}
};

然后错误消失了

最佳答案

通过将其添加到文件顶部来解决问题:

/* eslint-disable */

关于javascript - react : expected an assignment or function call and instead saw an expression no-unused-expressions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55332168/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com