Saltearse al contenido

Diagnósticos

Los diagnósticos de Biome están llenos de información, y normalmente proporcionan toda la información que necesita para entender los errores, y solucionarlos.

Los diagnósticos no sólo sirven para detectar errores, sino también para proporcionar información estructurada, advertencias y consejos.

Esta página ofrece un desglose de toda la información que puede contener un diagnóstico. Aprender todas las partes de un diagnóstico puede ayudarle a identificar las partes importantes y algunos “secretos” que se esconden tras ellas.

La gravedad del diagnóstico puede afectar a la CLI. Por ejemplo, los diagnósticos de error obligarán a la CLI a salir con un código de error.

Los diagnósticos de error tienen texto en rojo. Los diagnósticos fatales suelen emitirse cuando se produce un error inesperado dentro de Biome. En comparación con los errores, tienen la etiqueta fatal.


 FATAL  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  
   Biome exited as this error could not be handled and resulted in a fatal error. Please report it if necessary.
  

Los diagnósticos de error tienen texto en rojo. Por lo general, deben ser abordados porque emitirán un código de error cuando se encuentran por la CLI.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

Los diagnósticos de advertencia tienen texto amarillo. Por lo general, deben ser atendidos. Las advertencias no son bloqueos y no impedirán que la CLI funcione.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

Los diagnósticos de información tienen texto verde. Proporcionan información útil y no están destinados a bloquear la CLI.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

Las etiquetas pueden verse como metadatos adjuntos a un diagnóstico, y pueden afectar a los clientes de diferentes maneras.

Los diagnósticos detallados suelen estar ocultos. A través de la CLI, puede mostrar estos diagnósticos utilizando la opción --verbose.


 VERBOSE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

Los diagnósticos internos se emiten cuando se produce un error interno. Normalmente se anima a los usuarios a presentar un error cuando ven uno.


 INTERNAL  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  
   This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.
  

Los diagnósticos reparables se emiten para aquellas situaciones particulares que pueden ser reparadas por el usuario. Suelen utilizarse para diagnósticos de pelusa que tienen una acción de código.


 FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

Diagnósticos que contienen código obsoleto


 DEPRECATED  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

La categoría sirve para el diagnóstico del grupo. Opcionalmente, una categoría puede tener un enlace, por ejemplo para categorías que pertenecen a reglas de lint, como en el ejemplo siguiente.

Este diagnóstico pertenece a la categoría “check”, lo que significa que se emite al ejecutar el comando check:


check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

Este diagnóstico pertenece a la categoría “lint/a11y/noAccessKey”. El enlace lleva al usuario a la página web de la regla lint noAccessKey.


lint/a11y/noAccessKey ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

Localización del diagnóstico

Section titled Localización del diagnóstico

Los diagnósticos pueden tener una “localización”. Una ubicación se compone de tres partes opcionales:

  • un recurso, que es el origen que emitió el diagnóstico;
  • código fuente del archivo;
  • un span (o rango de texto), normalmente la línea y la columna dentro del archivo.

Ruta del archivo de diagnóstico

Section titled Ruta del archivo de diagnóstico

La ruta del archivo suele ser la primera información que aparece, en la parte superior izquierda del diagnóstico.


path/to/file.js ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  

Código fuente de diagnóstico

Section titled Código fuente de diagnóstico

Esto muestra cómo se muestra el código fuente asociado a un archivo. Observa que la línea y las columnas no se muestran.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  
  > 1 │ Some source code
        ^^^^^
  

Línea y columna de diagnóstico

Section titled Línea y columna de diagnóstico

Line y column suele imprimirse junto a la ruta del archivo, y sólo se muestra cuando hay algún código fuente asociado.


path/to/file.txt:1:6 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  
  > 1 │ Some source code
        ^^^^^^
  

Cuando los diagnósticos se imprimen dentro de la terminal de un IDE, puede hacer clic en ruta/al/archivo.js:2:2, y el IDE abrirá el archivo relativo, y colocará el cursor al principio del tramo.


path/to/file.js:2:2 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  
    1 │ function name() {
  > 2 │ 	return 'lorem'
   	^^^^^^^^^^^^^^
    3 │ }
  

Además, nuestros diagnósticos pueden almacenar avisos. Los avisos son mensajes adicionales que pueden añadirse al mensaje original.

Estos consejos son de diferentes tipos y formas. Normalmente, los consejos siempre se imprimen, a menos que sean consejos verbales.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   This is the message of the diagnostic. It will appear in different colours based on the severity of the diagnostic.
  
   This log is an error.
  
   This log is a warning
  
   This log is an information
  
  This log doesn't have any category. Below, you'll have a command
  
  $ biome command
  
  Below, a group.
  
  I am a group
  
     First message of a group.
    
     Second message of a group.
    
  Below, a list.
  
  - First item
  - Second item
  
  Below, a diff.
  
  - Old·code
  + New·code
  
  Below, a code frame.
  
  > 1 │ Lorem
   ^^^
    2 │ Ipsum