google / google/closure-compiler

Linter warns on unused for-of variable

Open
#2,341 3 comments 0 reactions 1 assignee Claimed by @MatrixFrog View on GitHub
lint
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

The following is a pain to do in any other way when `iter` is an arbitrary iterable:

```js
let count = 0;
for (const unused of iter) count++;
```

But the linter warns that `unused` is never read. Possible workarounds would be (1) don't warn about unused variables whose names start with "unused", (2) possibly restrict this check to for-of variables.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.