Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Bug: [no-useless-empty-export] false-positive for .d.ts file with only type exports #4975

Copy link
Copy link
Closed
@Josh-Cena

Description

@Josh-Cena
Issue body actions

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

Sigh This is supposed to be a simple reproduction, but the playground cannot treat the current file as a .d.ts file, so I have to provide a repo.

Reproduction Repository Link

https://github.com/Josh-Cena/ts-eslint-repro

Repro Steps

  1. clone the repo
  2. yarn install
  3. Go to index.d.ts -> see that the export {} is flagged
  4. Comment it out, and go to another-file.d.ts -> see that I'm able to import a non-exported type.

The reason is because .d.ts files with only type exports are still seen as scripts. (microsoft/TypeScript#38592) However, when I'm developing a utility type library, I don't really want to use .ts files that only export types—using .d.ts files makes sure the file only contains typedefs, and do not need to be compiled.

I expect the rule to not report empty exports in a .d.ts file with only type import/exports.

Versions

package version
@typescript-eslint/eslint-plugin 5.23.0
@typescript-eslint/parser 5.23.0
@typescript-eslint/scope-manager 5.23.0
@typescript-eslint/typescript-estree 5.23.0
@typescript-eslint/type-utils 5.23.0
@typescript-eslint/utils 5.23.0
TypeScript 4.6.4
ESLint 8.15.0
node 18.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.