Replace index loops with for-of-loops

This commit is contained in:
Nikita Karamov 2022-02-10 22:34:16 +01:00
parent 733a8da0b7
commit a0a7c02e0a
No known key found for this signature in database
GPG Key ID: 3C8E688C96EEB9C9
2 changed files with 2 additions and 19 deletions

View File

@ -4,9 +4,6 @@
"browser": true
},
"extends": ["eslint:recommended", "plugin:unicorn/recommended", "prettier"],
"rules": {
"unicorn/no-for-loop": 0
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"

View File

@ -38,23 +38,9 @@ const initializeShareon = () => {
const shareonContainers = document.querySelectorAll(".shareon");
// iterate over <div class="shareon">
for (
let containerIndex = 0;
containerIndex < shareonContainers.length;
containerIndex += 1
) {
/** @type Element */
const container = shareonContainers[containerIndex];
for (const container of shareonContainers) {
// iterate over children of <div class="shareon">
for (
let childIndex = 0;
childIndex < container.children.length;
childIndex += 1
) {
/** @type Element */
const child = container.children[childIndex];
for (const child of container.children) {
if (child) {
const classListLength = child.classList.length;