Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Source attribute injection breaks JSX elements with generic type arguments

Aperta
#274 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
tooling

Direzione di ricerca

The issue identifies the Vite plugin injector and four failing TSX files, including platform/settings/SubscriptionWizard.tsx at line 101. Read the injector and its existing tests first, then reproduce the failure with a generic JSX element and nested generics. Done means the injected attributes follow the type arguments and both cases pass; the issue also calls for considering a source injection opt-out and updating the installer draft.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: overlay bug

What

The Vite plugin injects data-source-file and data-source-line attributes into JSX elements so findings can point at a source line. The plugin runs with enforce: 'pre', so it sees raw TSX before the React transform. A component used with a generic type argument, such as <PageWizard<SubscriptionWizardData> ...>, gets the attributes inserted inside the type argument and the file no longer parses. The dev server returns 500 for every module that imports it, and the application renders nothing.

Evidence

Measured on a real product UI the night before the freeze: platform/settings/SubscriptionWizard.tsx:101, platform/access/api-tokens/ApiTokenForm.tsx:157, platform/settings/runtime-feature-flags/FeatureFlagsPage.tsx:96, platform/settings/ui-flags/UIFlagsPage.tsx:30 all fail with Unexpected token at the position of the generic argument. The small demo application never showed it because it has no generic components. Moving the plugin later in the plugins array does not help because of enforce: 'pre'.

Direction

Make the injector skip a generic type argument list when it finds the tag name: treat <Name<...> as the element Name and insert the attributes after the closing > of the type arguments. Add a test with a generic element and one with nested generics. Until then, document in the installer's draft that applications using generic JSX elements should pass an option that disables source injection, if one exists, and add such an option if it does not.

Lingua principale
TypeScript
Stelle
0
Fork
0
Merge medio
2h 48m
PR unite (30g)
8

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di usabl-dev/usabl

Tutte le issue di usabl-dev/usabl

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.