buildo / eslint-plugin-no-loops

It's 2024 and you still use loops?

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggest alternative(s)

josephgrossberg opened this issue · comments

If we tell folks that for loops are bad, perhaps we can suggest the alternatives they should consider (e.g. forEach)?

The articles linked in the Why section of the readme already provide alternatives.

Feel free to send a PR to make them more visible, but I would prefer to link to existing resources, instead of duplicating content in the readme

@gabro Could this plugin allow for custom messages recommending the functional methods?

I am picturing how the no-restricted-imports does it, where the rule allows you to pass a custom message that is given when the rule is triggered.

My use case is my inexperienced team members are going to be in code and see this error which is currently loops are not allowed, and then not know what that means. Yes, obviously they can ask the other experienced developers, and yes we can train people on why not to use loops, but having a custom error message that says like Loops are not allowed. Please use .forEach() .map() .filter() and .reduce() or Loops are not allowed. Please read this article for more: https://www.codereadability.com/coding-without-loops/