-
-
Notifications
You must be signed in to change notification settings - Fork 169
Description
While many of us use and enjoy using closures all over the place (or non-"pure" functions), taking advantage of their ability to borrow from their surrounding context, without any rule enforcement, such code can become a non-modular, non-unit-testable, non-externally-reusable spaghetti of functions, with too many contextual dependencies and preventing closures from being moved externally if necessary and may cause memory leaks/prevent garbage collection.
I'd like to see a non-standard JSDoc tag (akin to PHP's "use" language construct) to help with this, as well as to make no-shadow less unpleasant as detailed in the ESLint report.
I detailed such an idea at eslint/eslint#11061 though it was rejected from ESLint proper.
While I don't think this should be a recommended rule, I think it could provide some useful linting qualities and wanted to get your thoughts.
Update: Would be nice to also support other tags for enforcing the degree of function purity like @setsProperty {type} target name, @addsProperty {type} target name, @removesProperty.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.