Skip to content

feat!: define rule for consistent type import style #263

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

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Mar 6, 2025

Prefer:

import type { Foo } from 'bar'

over

import { type Foo } from 'bar'

After compilation it doesn't make any difference but it would be good to settle on one style or the other.

Turns out it does, the former gets removed entirely, the latter compiles to:

import {} from 'bar`

..which can lead to runtime failures if bar is only a devdep of the project (recommended by definitely typed for @types/bar-style dependencies.

BREAKING CHANGE: type import style is now specified, re-run linting with --fix to patch up any rule violations

Prefer:

```ts
import type { Foo } from 'bar'
```

over

```ts
import { type Foo } from 'bar'
```

After compilation it doesn't make any difference but it would be good to settle on one style or the other.

BREAKING CHANGE: type import style is now specified, re-run linting with `--fix` to patch up any rule violations
@achingbrain achingbrain changed the title feat!: define rules for consistent type import style feat!: define rule for consistent type import style Mar 6, 2025
@achingbrain achingbrain merged commit 948ce47 into main Apr 30, 2025
19 checks passed
@achingbrain achingbrain deleted the achingbrain-patch-1 branch April 30, 2025 11:26
github-actions bot pushed a commit that referenced this pull request Apr 30, 2025
## [8.0.0](v7.0.6...v8.0.0) (2025-04-30)

### ⚠ BREAKING CHANGES

* type import style is now specified, re-run linting with `--fix` to patch up any rule violations

### Features

* define rules for consistent type import style ([#263](#263)) ([948ce47](948ce47))

### Trivial Changes

* fix ci ([dbd1afc](dbd1afc))
Copy link

🎉 This PR is included in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

1 participant