Disable for...of by default, rewrite cases where it matters (#12198)

* Add no-for-of lint rule

* Ignore legit use cases of for..of

* Rewrite for..of in source code
This commit is contained in:
Dan Abramov
2018-02-09 16:11:22 +00:00
committed by GitHub
parent b5e9615087
commit 467b1034ce
13 changed files with 30 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ function invertObject(targetObj /* : ErrorMap */) /* : ErrorMap */ {
const result = {};
const mapKeys = Object.keys(targetObj);
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const originalKey of mapKeys) {
const originalVal = targetObj[originalKey];