Initial Setup
Sidecar is used via Sidecar-based rule packages like design_system_lints.
There are 2 modes which these packages can be run within a Dart or Flutter Project: IDE Server or Cli mode.
IDE Server Mode
Requirements
- Supported IDE with Extension for Dart Language Server
- Dart SDK v2.17.0+
Setup Instructions
To enable any Sidecar-based package like design_system_lints to display lints and assist recommendations within your IDE, perform the following setup steps:
- Depend on the lint package:
pubspec.yaml
name: counter_app
environment:
sdk: ">=2.17.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
dev_dependencies:
design_system_lints: ^0.1.0-dev.8
- Create a
sidecar.yaml
file at the Target Project's root directory and declare any rules from the package:
sidecar.yaml
includes:
- "lib/**.dart"
lints:
design_system_lints:
rules:
avoid_sized_box_height_width_literals:
avoid_text_style_literal:
avoid_border_radius_literal:
avoid_box_shadow_literal:
avoid_edge_insets_literal:
- Enable the Sidecar plugin to run by adding
sidecar
to the list of plugins inanalysis_options.yaml
analysis_options.yaml
analyzer:
plugins:
- sidecar
That's all it takes! Your lints should begin appearing in your editor.
CLI Mode
CLI Mode is useful for running lint rules from a CI/CD pipeline. To use Sidecar in CLI mode, run the following command in your terminal:
# activate sidecar
dart pub global activate sidecar
# run sidecar analyzer in CLI mode
sidecar analyze
You should see analysis results appear for each file in your project:
Contributing CLI Use Cases
If you have a particular CLI use case in mind, your feedback would be greatly appreciated in the Discord channel