From 8e21f26175b1ae1891c0e7e4d18dcab335f8d8d7 Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Wed, 10 Nov 2021 01:11:31 -0500 Subject: [PATCH] fix: consistently use `index` (#4196) --- packages/insomnia-app/app/common/render.ts | 4 ++-- .../modals/workspace-environments-edit-modal.tsx | 4 ++-- .../app/ui/components/settings/shortcuts.tsx | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/insomnia-app/app/common/render.ts b/packages/insomnia-app/app/common/render.ts index 053a6a09e..2ec0d61be 100644 --- a/packages/insomnia-app/app/common/render.ts +++ b/packages/insomnia-app/app/common/render.ts @@ -356,8 +356,8 @@ export async function getRenderContext( // Get Keys from ancestors (e.g. Folders) if (ancestors) { - for (let idx = 0; idx < ancestors.length; idx++) { - const ancestor: any = ancestors[idx] || {}; + for (let index = 0; index < ancestors.length; index++) { + const ancestor: any = ancestors[index] || {}; if ( isRequestGroup(ancestor) && diff --git a/packages/insomnia-app/app/ui/components/modals/workspace-environments-edit-modal.tsx b/packages/insomnia-app/app/ui/components/modals/workspace-environments-edit-modal.tsx index cacba060e..fdcb58d3c 100644 --- a/packages/insomnia-app/app/ui/components/modals/workspace-environments-edit-modal.tsx +++ b/packages/insomnia-app/app/ui/components/modals/workspace-environments-edit-modal.tsx @@ -362,9 +362,9 @@ export class WorkspaceEnvironmentsEditModal extends PureComponent // Do this last so we don't block the sorting db.bufferChanges(); - Promise.all(newSubEnvironments.map((environment, idx) => this._updateEnvironment( + Promise.all(newSubEnvironments.map((environment, index) => this._updateEnvironment( environment, - { metaSortKey: idx }, + { metaSortKey: index }, false, ))).then(() => { db.flushChanges(); diff --git a/packages/insomnia-app/app/ui/components/settings/shortcuts.tsx b/packages/insomnia-app/app/ui/components/settings/shortcuts.tsx index c7886b613..ecfe60ff7 100644 --- a/packages/insomnia-app/app/ui/components/settings/shortcuts.tsx +++ b/packages/insomnia-app/app/ui/components/settings/shortcuts.tsx @@ -82,9 +82,9 @@ export class Shortcuts extends PureComponent { const { hotKeyRegistry, handleUpdateKeyBindings } = this.props; const keyCombs = getPlatformKeyCombinations(hotKeyRegistry[hotKeyRefId]); let toBeRemovedIndex = -1; - keyCombs.forEach((existingKeyComb, idx) => { + keyCombs.forEach((existingKeyComb, index) => { if (areSameKeyCombinations(existingKeyComb, keyComb)) { - toBeRemovedIndex = idx; + toBeRemovedIndex = index; } }); @@ -105,18 +105,18 @@ export class Shortcuts extends PureComponent { handleUpdateKeyBindings(newDefaultRegistry()); } - renderHotKey(def: HotKeyDefinition, i: number) { + renderHotKey(def: HotKeyDefinition, index: number) { const keyBindings = this.props.hotKeyRegistry[def.id]; const keyCombinations = getPlatformKeyCombinations(keyBindings); const hasRemoveItems = keyCombinations.length > 0; const hasResetItems = !areKeyBindingsSameAsDefault(def.id, keyBindings); return ( - + {def.description} - {keyCombinations.map((keyComb: KeyCombination, idx: number) => { + {keyCombinations.map((keyComb: KeyCombination, index: number) => { return ( - + ); @@ -181,8 +181,8 @@ export class Shortcuts extends PureComponent { - {HOT_KEY_DEFS.map((def: HotKeyDefinition, idx: number) => { - return this.renderHotKey(def, idx); + {HOT_KEY_DEFS.map((def: HotKeyDefinition, index: number) => { + return this.renderHotKey(def, index); })}