Skip to content

Presets

Santiago Garcia Gil edited this page Sep 21, 2023 · 6 revisions

Pressets

This project contains a list of predefined presets for DCL:

  • All: contains all available lint rules for Dart and Flutter.
    • Dart: contains all lint rules applicable to any Dart app.
    • Flutter: contains all lint rules applicable to any Flutter app.

Suggestions

  • Recommended: contains recommended Dart and Flutter rules (with an emphasis on finding errors).
  • Recommended metrics: contains recommended configured metrics.

Packages

  • Flame: contains lint rules for the Flame package.
  • Intl: contains lint rules for the Intl package.

How to use a preset

Take these steps to enable a preset:

  1. Install this package as a dev dependency:

    dart pub add --dev dart_code_linter 
    

    or:

    flutter pub add --dev dart_code_linter
    
  2. For DCL configuration add the extents entry:

    dart_code_linter:
      extends:
        - package:dart_code_linter/presets/all.yaml

Disabling or reconfiguring a rule from the preset

To disable a rule, simply set its value to false:

dart_code_linter:
  extends:
    - package:dart_code_linter/presets/all.yaml
  rules:
    - avoid-banned-imports: false

To reconfigure a rule, that is included into a preset:

dart_code_linter:
  extends:
    - package:dart_code_linter/presets/all.yaml
  rules:
    - arguments-ordering:
        child-last: true

Defining a custom preset

Any other preset can be passed to the extends entry. To create a custom preset create a yaml file with the same structure as for regular DCL configuration.