https://github.com/buildo/eslint-plugin-no-loops
It's 2024 and you still use loops?
https://github.com/buildo/eslint-plugin-no-loops
Last synced: 25 days ago
JSON representation
It's 2024 and you still use loops?
- Host: GitHub
- URL: https://github.com/buildo/eslint-plugin-no-loops
- Owner: buildo
- License: mit
- Created: 2016-01-19T14:20:48.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-06-14T08:05:52.000Z (11 months ago)
- Last Synced: 2025-03-24T00:02:46.850Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 33.2 KB
- Stars: 130
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-eslint - no-loops - It's 2019 and you still use loops? (Plugins / Practices and Specific ES Features)
- fucking-awesome-eslint - no-loops - It's 2019 and you still use loops? (Plugins / Practices and Specific ES Features)
README
# eslint-plugin-no-loops
It's 2024 and you still use loops?[](https://travis-ci.org/buildo/eslint-plugin-no-loops)
[](https://www.npmjs.com/package/eslint-plugin-no-loops)
![]()
## Installation
```sh
npm install --save-dev eslint-plugin-no-loops
```## Usage
In your `.eslintrc`:```javascript
{
"plugins": [
"no-loops"
],
"rules": {
"no-loops/no-loops": 2
}
}
```## Rule
Disallow use of loops (for, for-in, while, do-while, for-of).## Why
You [don't](http://www.codereadability.com/coding-without-loops/) [need](http://joelhooks.com/blog/2014/02/06/stop-writing-for-loops-start-using-underscorejs/) [them](http://www.sitepoint.com/quick-tip-stop-writing-loops-start-thinking-with-maps/).## I know better, I need one now
If 99% of your code doesn't need them, but you have that single case where a loop makes sense, go ahead!```javascript
// eslint-disable-next-line no-loops/no-loops
for (let i = 0; i < arr.length; i++) {
// ...
}
```What is a rule without its exceptions?