Skip to content
pubscout

custom_lint

0.8.1, released a year ago by invertase.io

Tool for creating and running custom Dart lint rules

Repository archivedQuiet but busy
$ flutter pub add custom_lint
Source repository

What it does

Provides a framework to write, test, and distribute custom lint rules for Dart projects. It includes a CLI, hot‑reload support, and built‑in testing helpers.

AI-written summary of version 0.8.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need project‑specific lint rules not covered by default lints
  • You want to enforce coding standards across a team or CI
  • You want to bundle lint rules with a library for consumers

Skip it when

  • You only need standard lints
  • You prefer a lightweight static analysis tool without plugin support

Strengths

  • Easy to write and test lints
  • Hot‑reload and debugging support
  • Built‑in ignore handling and CI integration

Weaknesses

  • Requires Dart SDK 3.0+
  • Adds a dev dependency and analysis_options configuration
  • Learning curve for plugin API

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
18

Add custom_lint to dev_dependencies, create analysis_options.yaml with plugins: - custom_lint, optionally configure rules. No build_runner needed.

// analysis_options.yaml
analyzer:
  plugins:
    - custom_lint

# In a custom lint package
class MyLint extends DartLintRule {
  MyLint() : super(code: _code);
  static const _code = LintCode(name: 'my_lint', problemMessage: 'Example lint');
  @override
  void run(CustomLintResolver resolver, ErrorReporter reporter, CustomLintContext context) {
    context.registry.addVariableDeclaration((node) {
      reporter.atNode(node, _code);
    });
  }
}

Alternatives

Packages that do the same job and could replace custom_lint.

Works with

Packages commonly used together with custom_lint: ones it builds on, ones built on it, and its own family.