Skip to content

Bug: [consistent-type-exports] Importing a shadowing type breaks consistent-type-exports #11761

@simon-abbott

Description

@simon-abbott

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Issue Description

The following piece of code has two issues:

import { SomeThing } from './types.js';

const SomeThing = { foo: 'bar' };

export { SomeThing };

Firstly, it does not flag that import { SomeThing } from './types.js'; should be import { type SomeThing } from './types.js'; (problem with consistent-type-imports).

Secondly, it does error with "All exports in the declaration are only used as types.", even though the export is very clearly not a type.

This issue manifested itself in v8.43.0. I suspect it is a regression to do with #11457

Reproduction Repository Link

https://github.com/simon-abbott/ts-eslint-issue-mre-import-shadowing

Repro Steps

  1. clone the repo
  2. npm install
  3. npm run lint

Running npm run lint should error on the import in src/index.ts, and should not error on the export. Instead it does the reverse.

Versions

package version
@typescript-eslint/eslint-plugin 8.46.4
@typescript-eslint/parser 8.46.4
TypeScript 5.9.2
ESLint 8.57.1
node 22.19.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions