biome icon indicating copy to clipboard operation
biome copied to clipboard

📎 Implement `biome lint --rule=<rule-name>`

Open Conaclos opened this issue 10 months ago • 5 comments

Description

Executing biome lint --rule=<rule-name> should only run the rule with name <rule-name>, otherwise it will throw an error. See rome#4747 for more context.

EDIT: --rule=<rule-name> should override the config, i.e. run <rule-name> even if the rule is disabled in the config. However, the rule options and severity level should be taken into account.

If the option is combined with --summary (e.g. biome lint --summary --rule=<rule-name>) we should restrict the summary to <rule-name>. See #57 for more details about the --summary option.

An example:

$ biome lint --rule useSingleCaseStatement src

src/services/types.ts:1121:5 lint/nursery/useNamingConvention ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ⚠ This property name should be in camelCase.
  
  > 1121 │     InsertSpaceAfterConstructor?: boolean;
         │     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  ℹ The name could be renamed to `insertSpaceAfterConstructor`.


$ biome lint --summary --rule useSingleCaseStatement src

Rule name                          Diagnostics
nursery/useSingleCaseStatement        1

Possible extensions

  • Multi rule filtering (keeping diagnostics of a given set of rules)
  • reverse filtering, i.e. keeping all diagnostics except the diagnostics of a given rule

Conaclos avatar Aug 23 '23 21:08 Conaclos