Semi Lint

提供一套简洁、易用、可定制的 Dart 代码分析规则。

基于官方 analysis_server_plugin 构建。

要求 Dart >= 3.10 (Flutter >= 3.38)

开始使用

flutter pub add semi_lint --dev

analysis_options.yaml 中添加

include: package:semi_lint/lint.yml

plugins:
  semi_lint: ^2.0.0

注意plugins: 必须直接写在项目的 analysis_options.yaml 中,不能通过 include 继承。 include 只提供 linter rules 和 analyzer 配置;plugins 负责启用自定义分析插件。

自定义规则

本包内置以下自定义分析规则,通过 analysis_server_plugin 提供:

规则名 说明
picker_item_value_notifier_catch_rethrow ValueNotifier<...> 且泛型包含 PickerItem 时,catch 须包含 rethrow

这些规则注册为 warning 级别,默认开启。可通过标准 // ignore: 注释抑制:

// ignore: semi_lint/picker_item_value_notifier_catch_rethrow

联系

许可证

MIT License