Repository navigation
feat(eslint,oxlint)!: enforce type imports with inline specifiers - #251
Merged
Merged
Conversation
commit: |
Enable consistent-type-imports with fixStyle "inline-type-imports" and no-import-type-side-effects, so type-only imports use `import type` and are fully erased under verbatimModuleSyntax, while mixed imports keep a single statement. import() type annotations stay allowed. BREAKING CHANGE: The TypeScript presets of @peerigon/configs/eslint and @peerigon/configs/oxlint now warn on regular imports that are only used as types and on imports that only contain inline type specifiers. Projects linting with --max-warnings 0 or --deny-warnings fail until these are fixed. eslint --fix fixes them in one run, oxlint --fix needs two. Code relying on side effects of a type-only import must add an explicit `import "a"`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
jhnns
force-pushed
the
jhnns/inline-vs-separate-type-imports
branch
from
October 19, 2026 19:39
e8486a2 to
bab4a77
Compare
|
🎉 This PR is included in version 27.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Enables
consistent-type-imports(fixStyle: "inline-type-imports",disallowTypeAnnotations: false) andno-import-type-side-effectsas warnings in the ESLint and Oxlint TypeScript rules. Imports that only contain types becomeimport type, so they are fully erased underverbatimModuleSyntax. Mixed imports stay in a single statement with inlinetypespecifiers.import()type annotations stay allowed because they are always erased and are common in test mocks (importOriginal<typeof import("a")>()). Addstype-imports.tsfixtures for both linters and updates the config snapshots.BREAKING CHANGE: The TypeScript presets of
@peerigon/configs/eslintand@peerigon/configs/oxlintnow warn when a regular import is only used as a type (import { A } from "a"→import type { A } from "a") and when an import only contains inline type specifiers (import { type A } from "a"→import type { A } from "a"). Projects that lint with--max-warnings 0or--deny-warningswill fail until these imports are fixed. Both rules are autofixable:eslint --fixfixes everything in one run,oxlint --fixneeds a second run because it first rewritesimport { A }toimport { type A }. UnderverbatimModuleSyntaxthe fixed imports are removed from the emitted JavaScript entirely, so code that relied on the side effects of a module that was only imported for its types must add an explicitimport "a".🤖 Generated with Claude Code