https://github.com/bafolts/tslint-no-closures
A typescript linting rule to discourage the usage of closures.
https://github.com/bafolts/tslint-no-closures
closure closures memory-leak tslint tslint-rules typescript
Last synced: 4 months ago
JSON representation
A typescript linting rule to discourage the usage of closures.
- Host: GitHub
- URL: https://github.com/bafolts/tslint-no-closures
- Owner: bafolts
- License: unlicense
- Created: 2017-05-23T03:13:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-24T03:23:44.000Z (over 8 years ago)
- Last Synced: 2025-02-04T17:25:31.048Z (9 months ago)
- Topics: closure, closures, memory-leak, tslint, tslint-rules, typescript
- Language: TypeScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tslint-no-closures
A typescript linting rule to discourage the usage of closures.
*THIS PROJECT IS STILL A WORK IN PROGRESS*
Closures in javascript can cause memory leaks in certain situations. Most closures can be avoided. This linting rule attempts
to find closures and log them as either warnings or errors in order to help avoid memory leaks.
```
"rules": {
"no-closures": true
}
```
With this rule enabled, common closure bugs will be marked as errors:
BAD:
```js
for (var i = 0; i < 100; i++) {
setTimeout(() => {
// i was not defined in this function
alert(i);
});
}
```