I am using ESLint to check my javascript code on build and I am getting a no-unused-vars error followed by a no-undef error for the same variable. I can't undertand how the variable can be both unused and undefined.
export function count(){
if (counter > 3){
const a = 'big';
} else {
const a = 'small';
}
return a;
}
Given the pseudode representation above I get the following errors from 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
Any ideas on how to get round this?