solana_kit_lints 0.9.1
solana_kit_lints: ^0.9.1 copied to clipboard
Shared lint rules for the Solana Kit Dart SDK.
solana_kit_lints #
Shared lint rules for all packages in the Solana Kit Dart SDK.
This is an internal package (publish_to: none) that centralizes the analysis configuration for the monorepo. It is not published to pub.dev.
Installation #
Install with:
dart pub add --dev solana_kit_lints
Within the solana_kit monorepo, the package resolves through the Dart workspace. This package is not intended for use outside the monorepo.
Documentation #
- Package page: https://pub.dev/packages/solana_kit_lints
- API reference: https://pub.dev/documentation/solana_kit_lints/latest/
- Guides website: https://openbudgetfun.github.io/solana_kit/
Usage #
Including the lint rules #
Create or update your package's analysis_options.yaml to include the shared rules:
include: package:solana_kit_lints/analysis_options.yaml
This single line gives your package the full set of lint rules used across the Solana Kit SDK. No additional configuration is needed in most cases.
For Flutter packages, include the Flutter preset instead:
include: package:solana_kit_lints/flutter_analysis_options.yaml
The Flutter preset uses flutter_lints as its base, then reapplies the Solana Kit analyzer severities and project-specific lint policy.
Adding package-specific overrides #
If a specific package needs to adjust a rule, add overrides after the include:
include: package:solana_kit_lints/analysis_options.yaml
linter:
rules:
avoid_print: false # Allow print in example/CLI packages
Configuration #
The shared analysis_options.yaml includes very_good_analysis as its base and applies the following customizations. Flutter packages use a separate preset because Dart analysis options only allow one top-level include:
include: package:flutter_lints/flutter.yaml
That Flutter preset layers the Solana Kit rules back on top.
Analyzer error severity #
The following diagnostics are promoted to errors to catch problems early:
| Diagnostic | Severity |
|---|---|
missing_return |
error |
dead_code |
error |
unused_element |
error |
unused_import |
error |
unused_local_variable |
error |
todo |
ignore |
Lint rule customizations #
The following rules from the base presets are customized for this project:
| Rule | Value | Reason |
|---|---|---|
public_member_api_docs |
true |
Published packages should document public API. |
lines_longer_than_80_chars |
false |
Many error messages, type signatures, and constant names in the SDK naturally exceed 80 characters. |
cancel_subscriptions |
true |
Catch leaked stream subscriptions. |
close_sinks |
true |
Catch leaked sinks and controllers. |
avoid_equals_and_hash_code_on_mutable_classes |
false |
Value-like mutable classes are allowed where package APIs require them. |
API Reference #
Provided files #
lib/analysis_options.yaml: the shared analysis options file that all Dart packages include. Built on top ofvery_good_analysiswith project-specific customizations.lib/flutter_analysis_options.yaml: the shared analysis options file for Flutter packages. Built on top offlutter_lintswith the Solana Kit analyzer severities and project-specific customizations layered back in.
Example #
Use example/README.md as a runnable starting point for solana_kit_lints.
- Import path:
N/A (lint package) - This section is centrally maintained with
mdtto keep package guidance aligned. - After updating shared docs templates, run
docs:updatefrom the repo root.
Maintenance #
- Validate docs in CI and locally with
docs:check. - Keep examples focused on one workflow and reference package README sections for deeper API details.