Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consistent-type-specifier-style: rename prefer-top-level #221

Open
privatenumber opened this issue Dec 26, 2024 · 1 comment
Open

consistent-type-specifier-style: rename prefer-top-level #221

privatenumber opened this issue Dec 26, 2024 · 1 comment

Comments

@privatenumber
Copy link

privatenumber commented Dec 26, 2024

Problem

Currently, the consistent-type-specifier-style rule has options prefer-top-level and prefer-inline.

While it uses the word "prefer", it doesn't seem to be preferential—but more of a requirement—as prefer-top-level errors on:

import { valueA, type typeB } from './file'

Proposal

  1. Rename the current options to top-level and inline

  2. Add a new prefer-top-level that only errors if it's possible to move the type to the top-level without causing a duplicate import:

    // Passes
    import { valueA, type typeB } from './file' // can be inline because making it top-level will require a separate import for valueA
    
    // Errors
    import { type typeB } from './file' // type should be top-level
@SukkaW
Copy link
Collaborator

SukkaW commented Dec 26, 2024

We can add top-level and inline as aliases for now. Changing the prefer-top-level would be a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants