sindresorhus/eslint-plugin-unicorn
Rule proposal: Forbid reassign top level variable in functions
Chiusa
#1092 aperta il 30 gen 2021
help wantednew rule
Metriche repository
- Star
- (5022 stelle)
- Metriche merge PR
- (Merge medio 1g 16h) (399 PR mergiate in 30 g)
Descrizione
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;
// ...
}