← Back to Pull requests

fix: translate import-lite `consistent-type-specifier-style` options #589

Open
unknown opened this pull request with 287 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 20, 2026 06:46 UTC
Author

Any project using @antfu/eslint-config gets a config oxlint refuses to load. antfu registers eslint-plugin-import-lite as import and sets import/consistent-type-specifier-style to ["error", "top-level"]. The migrator copies that option unchanged:

x Invalid configuration for rule `import/consistent-type-specifier-style`:
|   unknown variant `top-level`, expected one of `prefer-top-level`, `prefer-inline`, `prefer-top-level-if-only-type-imports`

The nuxt-auth snapshot (an antfu config) already contained the invalid value.

import-lite renamed the modes (prefer-top-level → top-level, prefer-inline → inline) and reused prefer-top-level for a looser mode. This PR maps them in fixForAntfuEslintConfig, after the plugin renames:

| import-lite | Oxlint |
|---|---|
| top-level | prefer-top-level |
| inline | prefer-inline |
| prefer-top-level | prefer-top-level-if-only-type-imports |

The mapping only runs when the plugin registered as import is import-lite, which is when its rule schema lists top-level. With antfu({ imports: false }), users can register eslint-plugin-import as import, and there prefer-top-level keeps its strict meaning. I checked the third row with import-lite's own test cases run through oxlint:

| Case | import-lite prefer-top-level | oxlint prefer-top-level-if-only-type-imports |
|---|---|---|
| import { Foo, type Bar } | valid | valid |
| import { type Foo, type Bar } | invalid | reported |

A config that exports await antfu() instead of the composer skips fixForAntfuEslintConfig, same as the plugin renames, so it still gets top-level.

Repro: https://github.com/onmax/repros/tree/repro/oxlint-migrate-import-lite-type-specifier-style (pnpm install --frozen-lockfile && pnpm verify in the fixture; verification.log shows the failing fixture and the patched sibling).

Tests: new cases in src/js_plugin_fixes.spec.ts run through fixForJsPlugins. The three mappings fail on main, and eslint-plugin-import's prefer-top-level stays unchanged. The nuxt-auth snapshot is updated. vitest run, oxlint --type-aware --type-check, oxfmt --check and tsc --noEmit pass.

Diff: 287 lines (+215 / -72) across 3 files Reviewer: connorshea Review duration: 63982m
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.47) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 287 lines diff across 3 files
0.47
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
44%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.339
Real PR Conversation Timeline
1 comments
"Review active on #589"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 44.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 46.8% (MEDIUM) · Higher = larger blast radius
46.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 44.7% · Lower = rushed or shallow review
44.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 25.9% · Safe to merge
25.9%