lints_tool 1.1.1
lints_tool: ^1.1.1 copied to clipboard
A strict, prod-ready lint and analyzer rule set for Dart and Flutter projects, built on flutter_lints and DCM.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.1.1 - 2026-09-20 #
Changed #
avoid-future-ignoreis enabled, reversing the 1.1.0 decision.Future.ignore()isthen(_ignore, onError: _ignore): the error is consumed before it reaches the zone, so it never reaches the crash reporter. 400 call sites across the line were rewritten tounawaited(...), which marks a future as intentionally not awaited and still reports its failure.- 27 of them were put back under a documented
// ignore:, in two shapes the rule cannot tell apart from a swallow. - 24 are inside the telemetry sinks. The unhandled-error path runs through them
(
runZonedGuarded->logZoneError->log.error-> the sink), sounawaitedthere closes an unbounded feedback loop. - 3 are cleanup chains in
http_kit'sApiClient:whenCompletederives a second future from one the caller already receives, sounawaitedreported every request failure twice (23 tests red)..ignore()suppresses the duplicate there, not the error.
1.1.0 - 2026-09-19 #
Every rule below was measured on BreakerSonar and DoctorNoise before it was kept or dropped.
Fixed #
metrics:was a YAML list of scalars where DCM expects a map, so 21 of its 22 thresholds had never applied.dcm init metrics-preview --only-enabledreported 1 metric; it now reports 15.maintainability-indexcarried a pre-1.35 value on what is now a 0..1 scale.strict-raw-types: truedid nothing:strict_raw_typeis the only diagnostic it emits, anderrors:silenced it. That and three sibling suppressions cost 6 findings to remove.unsafe_htmlis removed from the Dart linter;prefer_relative_importsandalways_put_control_body_on_new_linecarried a severity while disabled.enable-experimentlistedmacros(cancelled 2025-01),varianceandconst-functions.dcm: formatter: cascading-widget-extensionsis a removed flag, andline-lengthloses to Dart'spage_width.avoid-missing-image-althad been dropped as unknown; it was renamed toprovide-image-semantic-labelin 1.39 and is not web-only. Its whole family came back with it.
Added #
formatter:ships with the include, so consumers stop repeating it.extends: metrics-recommended— a built-in preset, so the package still has no dependencies.- 63 DCM rules: accessibility (13), security (4), async correctness (7), wrong-code catchers and four pubspec rules. 303 recognised rules became 366.
- 34 Dart lints, including the 8 the set had drifted behind
flutter_lints6.0.0, anddiscarded_futures/no_dynamic_casts/no_raw_types, first withdrawn for an overlap that re-measurement disproved (36, 1 and 0 findings). curly_braces_in_flow_control_structuresback on: errorProne, part of that same baseline, and 5 findings in BreakerSonar. It only asks for braces once the body leaves theifline.
Measured, then scoped rather than dropped #
A rule that earns its place stays on; the noise is handled by scoping it to where its premise holds, not by deleting it.
avoid-unsafe-collection-methods,no-empty-blockandavoid-non-null-assertionare excluded from tests: there,.firstthrowing or a!blowing up IS the assertion. Numeric code that indexes by construction (a DSP package) excludes itself locally.avoid-collection-mutating-methodstakesignore-private: true— without it every_field.add(x)on an owned collection is a hit (112 of 125).no-equal-argumentsignores the layout parameters that are equal on purpose.avoid-unused-parameterstakesignore-inline-functions: true: builder signatures force them.
Not enabled, with the reason recorded #
avoid-future-ignore: 102 of 103 hits are a deliberate, commented.ignore()— the explicit way to mark a future as intentionally not awaited.prefer-correct-throws: needs@Throwsfromdart-code-metrics-annotations.no-empty-string: bans the''literal.unnecessary_type_name_in_constructor: rewrites all 315 constructors to the 3.13 spelling. Left asfalsewith the reason, ready for whenever primary constructors are adopted.
Changed #
- Install recipe is pub.flutter-io.cn, not a git ref.
- Requires DCM 1.39.2 or newer, the build the set was measured on. A
dcm_global.yamlfloor was tried and dropped: the check is Teams+, and it did not fire on Pro against a deliberate>=99.0.0.