Skip to content

[Bug] Import statements misplaced in middle of file between function and class definitions in BaseAction.ts #307

@zakaziko86

Description

@zakaziko86

Bug Description

Two import statements in src/lib/actions/BaseAction.ts
(lines 46-47) are placed in the middle of the file, between
the resolveNetwork function and the BaseAction class,
instead of at the top of the file with all other imports.

Root Cause

export function resolveNetwork(stored: string | undefined): GenLayerChain {
  // ... function body ending at line 45 ...
}

import { ethers } from "ethers";                              // LINE 46 — misplaced
import { writeFileSync, existsSync, readFileSync } from "fs"; // LINE 47 — misplaced

export class BaseAction extends ConfigFileManager {

Impact

  • Suggests a botched merge conflict resolution or bad refactoring
  • If a developer adds the same imports at the top, they become
    duplicated — esbuild would bundle both copies
  • Import analysis tools may miss these misplaced imports
  • Violates TypeScript/ESLint best practices
  • Could cause issues with isolatedModules or verbatimModuleSyntax

Suggested Fix

Move both imports to the top of the file (lines 1-9)
with all other imports and remove them from lines 46-47.

File

src/lib/actions/BaseAction.ts lines 46-47
Severity: Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions