sindresorhus/eslint-plugin-unicorn
Rule proposal: Forbid reassign top level variable in functions
Fechada
#1.092 aberto em 30 de jan. de 2021
help wantednew rule
Métricas do repositório
- Stars
- (5.022 estrelas)
- Métricas de merge de PR
- (Mesclagem média 4h 30m) (26 fundiu PRs em 30d)
Description
It's dangerous, and maybe get unexpected result when refactoring. In following example, if we change foo to async, or inside foo somehow reenter foo, cache may got change.
Fail
let cache;
function foo() {
cache = {};
// ...
}
export default foo;
Pass
function foo() {
let cache;
// ...
}