netlify/eslint-config-node

Discussion eslint rule `fp/no-loops`

lukasholzer opened this issue ยท 4 comments

I want to discuss this rule and why we are forbidding the use of for-of or for loops.

https://github.com/jfmengels/eslint-plugin-fp/blob/master/docs/rules/no-loops.md

In general if you need something performant a for loop is unbeatable on large scale

like

for (let i = 0, max = hugeSet.length(); i < max; i ++) {
...
}

a different example often you want to iterate over an iterate-able with entries in a sync manor where some async code is awaited:

for (const entry of entries) {
   await doSomeAsync(entry)
   console.log('done for entry')
}

IMO these are valid examples to use a for or forof and we should not forbid them.

cc @eduardoboucas @ehmicky @netlify-team-account-1 @ascorbic @erezrokah

I'm okay with removing it.

danez commented

It looks like we can move forward with this.

Let's do it! ๐Ÿš€

Can I suggest we remove the fp plugin entirely. I think it's far too opinionated for a global config like this.