【发布时间】:2017-06-26 02:54:20
【问题描述】:
我正在使用 ESLint 在构建时检查我的 javascript 代码,我收到一个 no-unused-vars 错误,然后是同一变量的 no-undef 错误。我无法理解变量如何既未使用又未定义。
export function count(){
if (counter > 3){
const a = 'big';
} else {
const a = 'small';
}
return a;
}
鉴于上面的伪表示,我从 ESLint 得到以下错误:
line 3 error 'a' is defined but never used no-unused-vars
line 5 error 'a' is defined but never used no-unused-vars
line 7 error 'a' is not defined no-undef
关于如何解决这个问题的任何想法?
【问题讨论】:
标签: javascript ecmascript-6 eslint