Skip to content

Typescript with invalid interface loaded as resolver import/order #1

@marsicdev

Description

@marsicdev

GitHub Issue for @hypetech/eslint-config

Repository: https://github.com/hypetechdev/eslint-config
Issue Title: Missing TypeScript resolver for eslint-plugin-import causes errors in TypeScript projects

Description

When using @hypetech/eslint-config v3.0.2 in a TypeScript project, ESLint throws the following error:

Error: Resolve error: typescript with invalid interface loaded as resolver import/order

This error occurs on all TypeScript files when the import/order rule tries to resolve imports.

Root Cause

The package includes eslint-plugin-import as a dependency, but doesn't include or configure eslint-import-resolver-typescript, which is required for the import plugin to properly resolve TypeScript imports.

Current Workaround

Projects using @hypetech/eslint-config need to manually:

  1. Install the TypeScript resolver:
npm install -D eslint-import-resolver-typescript
# or
pnpm add -D eslint-import-resolver-typescript
  1. Configure it in their ESLint config:
// eslint.config.mjs
import hypetechConfig from '@hypetech/eslint-config'

export default [
    ...hypetechConfig,
    {
        settings: {
            'import/resolver': {
                typescript: {
                    alwaysTryTypes: true,
                    project: './tsconfig.json'
                }
            }
        }
    },
]

Suggested Fix

Since @hypetech/eslint-config is designed for TypeScript projects (it includes @typescript-eslint/parser and @typescript-eslint/eslint-plugin), it should also include the TypeScript resolver for the import plugin.

Option 1: Add as dependency

Add eslint-import-resolver-typescript to the package dependencies:

{
  "dependencies": {
    // ... existing dependencies
    "eslint-import-resolver-typescript": "^3.6.1"
  }
}

Option 2: Configure in the preset

Include the TypeScript resolver configuration in the ESLint config preset:

// In the main config export
{
  settings: {
    'import/resolver': {
      typescript: {
        alwaysTryTypes: true,
        // Allow projects to override the project path
        project: './tsconfig.json'
      }
    }
  }
}

Environment

  • Node.js: v20.x (LTS) in CI, v22.x locally
  • @hypetech/eslint-config: v3.0.2
  • eslint: v9.x
  • TypeScript: v5.x
  • Next.js: 14.2.28

Impact

This issue affects all TypeScript projects using @hypetech/eslint-config, particularly in CI/CD environments where the error causes the lint step to fail.

Additional Context

The error doesn't always appear locally due to ESLint caching or different Node.js versions, but consistently appears in fresh CI environments.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions