Skip to content

Bug: [consistent-type-export] consider same-named term/types #10313

Open
@jasonkuhrt

Description

@jasonkuhrt

Before You File a Proposal Please Confirm You Have Done The Following...

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Link to the rule's documentation

https://typescript-eslint.io/rules/consistent-type-exports/

Description

I am working on making an enum-like data type in the graphql package tree shakable.

In doing that work we had to silence a few instances of consistent-type-export because it detected supposedly type-only exports when in fact it was not.

The code that seems to be tripping them up is:

import type * as Kind_ from './kinds_.js';

export * as Kind from './kinds_.js';

export type Kind = (typeof Kind_)[keyof typeof Kind_];

Cases we silenced ESLint:

The specific ESLint errors that are being silenced are:

/Users/jasonkuhrt/projects/jasonkuhrt/graphql-js/src/index.ts
  209:1  error  All exports in the declaration are only used as types. Use `export type`  @typescript-eslint/consistent-type-exports

/Users/jasonkuhrt/projects/jasonkuhrt/graphql-js/src/language/index.ts
  8:1  error  All exports in the declaration are only used as types. Use `export type`  @typescript-eslint/consistent-type-exports

Fail

N/A

Pass

N/A

Additional Info

Sorry for not filling out the template completely. I am not sure how this pattern should be supported by ESLint, what considerations there might be etc., so hoping to get some thoughts from others regarding this.

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy