Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Source attribute injection breaks JSX elements with generic type arguments

Abierto
#274 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
0
Forks
0
Merge medio
2 h 48 min
PR fusionados (30 d)
8

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de usabl-dev/usabl

Todos los issues de usabl-dev/usabl

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.