コンテンツにスキップ

診断

Biomeの診断結果には多くの情報が含まれており、通常エラーを理解して修正するために必要なすべての情報を提供します。

診断はエラーだけでなく、構造的な情報、警告、ヒントも提供します。

このページでは診断が含むすべての情報について詳しく説明します。 診断のさまざまな箇所について知ることで、重要な部分や “秘密” を見つけることに役立ちます。

診断の重要度はCLIに影響します。例えば、エラーの診断はCLIをエラーコードで終了させます。

エラーの診断は赤色のテキストです。深刻な診断は通常、Biomeの内部で予期しないエラーが起きた場合に出力されます。エラーと違って、fatalタグを持ちます。


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

   This diagnostic message is displayed in a color that reflects its severity.
  
   Biome exited as this error could not be handled and resulted in a fatal error. Please report it if necessary.
  

エラーの診断は赤色のテキストです。通常、CLIが検知した場合エラーコードを出力するため、エラーを解決するべきです。


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

   This diagnostic message is displayed in a color that reflects its severity.
  

警告の診断は黄色のテキストです。通常、これらは解決されるべきです。警告はブロッカではなく、CLIの動作を停止させません。


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

   This diagnostic message is displayed in a color that reflects its severity.
  

情報の診断は緑色のテキストです。これらは通常有用な情報を提供し、CLIをブロックしません。


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

   This diagnostic message is displayed in a color that reflects its severity.
  

Tags can be seen as metadata attached to a diagnostic, and they can affect the clients in different ways.

詳細な診断は通常表示されません。CLIでは、--verbose オプションでこうした診断を表示できます。


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

   This diagnostic message is displayed in a color that reflects its severity.
  

内部の診断は内部的なエラーが発生したときに出力されます。これに遭遇した場合は、バグを報告することが推奨されます。


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

   This diagnostic message is displayed in a color that reflects its severity.
  
   This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.
  

修正可能な診断は、ユーザによって修正可能な状況について出力されます。これらは通常コードアクションを持つリントの診断に使われます。


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

   This diagnostic message is displayed in a color that reflects its severity.
  

非推奨なコードを含む場合の診断です。


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

   This diagnostic message is displayed in a color that reflects its severity.
  

カテゴリは診断をグループ化します。以下の例のように、リントのルールが属するカテゴリによってはリンクが付く場合があります。

この診断は “check” カテゴリに属し、check コマンドを実行したときに出力されます:


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

   This diagnostic message is displayed in a color that reflects its severity.
  

この診断は “lint/a11y/noAccessKey” カテゴリに属します。リンクはユーザを noAccessKey のWebページへ誘導します。


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

   This diagnostic message is displayed in a color that reflects its severity.
  

診断は “場所” を持つことがあります。場所は3つの任意な部分からなります:

  • 診断が出力された元のリソース
  • ファイルのソースコード
  • スパン(またはテキストの範囲)。通常、ファイル内のです。

ファイルパスは通常、最初に目に入る情報で、診断の左上にあります。


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

   This diagnostic message is displayed in a color that reflects its severity.
  

これはソースコードがどのようにファイルに紐づけられるかを示します。行と列は表示されません。


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

   This diagnostic message is displayed in a color that reflects its severity.
  
  > 1 │ Some source code
        ^^^^^
  

は通常、ソースコードが紐づいている場合にファイルパスと一緒に表示されます。


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

   This diagnostic message is displayed in a color that reflects its severity.
  
  > 1 │ Some source code
        ^^^^^^
  

診断がIDEのターミナルの中で表示される場合、path/to/file.js:2:2 をクリックするとIDEが関連するファイルを開き、カーソルをスパンの始点に移動します。


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

   This diagnostic message is displayed in a color that reflects its severity.
  
    1 │ function name() {
  > 2 │ 	return 'lorem'
   	^^^^^^^^^^^^^^
    3 │ }
  

加えて、診断はアドバイスを持つこともあります。アドバイスは元のメッセージの後に付加される追加のメッセージです。

アドバイスにはさまざまな種類と形式があります。通常、アドバイスは 詳細なアドバイス でない限りは常に表示されます。


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

   This diagnostic message is displayed in a color that reflects its severity.
  
   An error message.
  
   A warning message.
  
   An informational message.
  
  An unstyled message can introduce a command:
  
  $ biome command
  
  Messages can be grouped under a heading:
  
  Related information
  
     First message of a group.
    
     Second message of a group.
    
  Messages can also be displayed as a list:
  
  - First item
  - Second item
  
  A diff can show a suggested change:
  
  - Old·code
  + New·code
  
  A code frame can highlight a source range:
  
  > 1 │ Lorem
   ^^^
    2 │ Ipsum